diff options
author | Tim Peters <tim.peters@gmail.com> | 2003-01-23 19:58:02 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2003-01-23 19:58:02 (GMT) |
commit | 10cadce41ec7b94aafc11b4f2c9cfb7587f5b81d (patch) | |
tree | a08fd27ddaa04db1b7cad9c552b08fd964e53a68 /Misc/NEWS | |
parent | 250684ddd8223de98b5944d13e89a12673d0a51a (diff) | |
download | cpython-10cadce41ec7b94aafc11b4f2c9cfb7587f5b81d.zip cpython-10cadce41ec7b94aafc11b4f2c9cfb7587f5b81d.tar.gz cpython-10cadce41ec7b94aafc11b4f2c9cfb7587f5b81d.tar.bz2 |
Reimplemented datetime.now() to be useful.
Diffstat (limited to 'Misc/NEWS')
-rw-r--r-- | Misc/NEWS | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -82,6 +82,17 @@ Extension modules creativity of political time zone fiddling appears unbounded -- fromutc() allows the highly motivated to emulate any scheme expressible in Python. + datetime.now(): The optional tzinfo argument was undocumented (that's + repaired), and its name was changed to tz ("tzinfo" is overloaded enough + already). With a tz argument, now(tz) used to return the local date + and time, and attach tz to it, without any conversion of date and time + members. This was less than useful. Now now(tz) returns the current + date and time as local time in tz's time zone, akin to + tz.fromutc(datetime.utcnow().replace(tzinfo=utc)) + where "utc" is an instance of a tzinfo subclass modeling UTC. Without + a tz argument, now() continues to return the current local date and time, + as a naive datetime object. + The constructors building a datetime from a timestamp could raise ValueError if the platform C localtime()/gmtime() inserted "leap seconds". Leap seconds are ignored now. On such platforms, it's |