Message45263
Logged In: YES
user_id=31435
Under the belief that the *intent* of this patch is to add a C
API to Python's datetime module, it should stick to exposing C
ways to spell what Python programmers can already do from
Python using datetime. Since nothing like TimeFromTicks()
exists in the Python datetime API, it simply doesn't make
sense to invent one available only from C. It *may* make
sense to invent one in a DB API wrapper around datetime, but
I view that as out of scope for this patch.
I would not add TimeFromTicks() to the Python datetime API
either, because the docs are ambiguous. The sample
implementation Marc-Andre posted here uses localtime() to
resolve the ambiguity in the docs, but that has to be a wrong
choice for some time-of-day apps. For example, there's
apparently no portable way to spell "noon" using
TimeFromTicks(): the value you get back depends on which
time zone localtime() happens to use at the time it's called.
If people want time-of-day from a POSIX timestamp, it
remains easy to get it from what datetime already supplies,
but to do so you have to be explicit about whether you want
UTC or local time interpretation. Both are easily spelled
already, and it's a Good Thing that you need to be explicit if
you want to do such a thing. |
|
Date |
User |
Action |
Args |
2007-08-23 15:31:57 | admin | link | issue876130 messages |
2007-08-23 15:31:57 | admin | create | |
|