- 24 Ock, 2003 1 kayıt (commit)
-
-
Tim Peters yazdı
changes (and there were a lot of relevant changes!).
-
- 23 Ock, 2003 5 kayıt (commit)
-
-
Neal Norwitz yazdı
-
Tim Peters yazdı
This gives much the same treatment to datetime.fromtimestamp(stamp, tz) as the last batch of checkins gave to datetime.now(tz): do "the obvious" thing with the tz argument instead of a senseless thing.
-
Tim Peters yazdı
-
Tim Peters yazdı
-
Tim Peters yazdı
checked in two days agao: Refactoring of, and new rules for, dt.astimezone(tz). dt must be aware now, and tz.utcoffset() and tz.dst() must not return None. The old dt.astimezone(None) no longer works to change an aware datetime into a naive datetime; use dt.replace(tzinfo=None) instead. The tzinfo base class now supplies a new fromutc(self, dt) method, and datetime.astimezone(tz) invokes tz.fromutc(). The default implementation of fromutc() reproduces the same results as the old astimezone() implementation, but tzinfo subclasses can override fromutc() if the default implementation isn't strong enough to get the correct results in all cases (for example, this may be necessary if a tzinfo subclass models a time zone whose "standard offset" (wrt UTC) changed in some year(s), or in some variations of double-daylight time -- the creativity of time zone politics can't be captured in a single default implementation).
-
- 20 Ock, 2003 1 kayıt (commit)
-
-
Tim Peters yazdı
When daylight time ends, an hour repeats on the local clock (for example, in US Eastern, the clock jumps from 1:59 back to 1:00 again). Times in the repeated hour are ambiguous. A tzinfo subclass that wants to play with astimezone() needs to treat times in the repeated hour as being standard time. astimezone() previously required that such times be treated as daylight time. There seems no killer argument either way, but Guido wants the standard-time version, and it does seem easier the new way to code both American (local-time based) and European (UTC-based) switch rules, and the astimezone() implementation is simpler.
-
- 11 Ock, 2003 2 kayıt (commit)
-
-
Tim Peters yazdı
-
Tim Peters yazdı
HASTZINFO() macro.
-
- 10 Ock, 2003 3 kayıt (commit)
-
-
Neal Norwitz yazdı
-
Tim Peters yazdı
hoped it would be, but not too bad. A test had to change: time.__setstate__() can no longer add a non-None tzinfo member to a time object that didn't already have one, since storage for a tzinfo member doesn't exist in that case.
-
Tim Peters yazdı
-
- 08 Ock, 2003 3 kayıt (commit)
-
-
Tim Peters yazdı
unreachable now.
-
Tim Peters yazdı
into time. This is little more than *exporting* the datetimetz object under the name "datetime", and similarly for timetz. A good implementation of this change requires more work, but this is fully functional if you don't stare too hard at the internals (e.g., right now a type named "datetime" shows up as a base class of the type named "datetime"). The docs also need extensive revision, not part of this checkin.
-
Jack Jansen yazdı
-
- 04 Ock, 2003 4 kayıt (commit)
-
-
Tim Peters yazdı
localtime()/gmtime() insists on delivering them, + associated doc changes. Redid the docs for datetimtez.astimezone().
-
Tim Peters yazdı
cases, plus even tougher tests of that. This implementation follows the correctness proof very closely, and should also be quicker (yes, I wrote the proof before the code, and the code proves the proof <wink>).
-
Neal Norwitz yazdı
-
Tim Peters yazdı
the desired compromise behavior during the "problem hour" when DST ends cheaply (but I haven't yet implemented that).
-
- 02 Ock, 2003 5 kayıt (commit)
-
-
Tim Peters yazdı
(or None) now. In 2.3a1 they could also return an int or long, but that was an unhelpfully redundant leftover from an earlier version wherein they couldn't return a timedelta. TOOWTDI.
-
Tim Peters yazdı
dst() returns None (instead of treating that as 0).
-
Tim Peters yazdı
turned out to be 3 special cases of a single more-general result. Proving the latter instead is a real simplification.
-
Tim Peters yazdı
On Windows, it was very common to get microsecond values (out of .today() and .now()) of the form 480999, i.e. with three trailing nines. The platform precision is .001 seconds, and fp rounding errors account for the rest. Under the covers, that 480999 started life as the fractional part of a timestamp, like .4809999978. Rounding that times 1e6 cures the irritation. Confession: the platform precision isn't really .001 seconds. It's usually worse. What actually happens is that MS rounds a cruder value to a multiple of .001, and that suffers its own rounding errors. A tiny bit of refactoring added a new internal utility to round doubles.
-
Tim Peters yazdı
correct by your lights, it means that-- barring coding errors --it implements what it intended to implement.
-
- 01 Ock, 2003 2 kayıt (commit)
-
-
Tim Peters yazdı
suggestion from Guido, along with a formal correctness proof of the trickiest bit. The intricacy of the proof reveals how delicate this is, but also how robust the conclusion: correctness doesn't rely on dst() returning +- one hour (not all real time zones do!), it only relies on: 1. That dst() returns a (any) non-zero value if and only if daylight time is in effect. and 2. That the tzinfo subclass implements a consistent notion of time zone. The meaning of "consistent" was a hidden assumption, which is now an explicit requirement in the docs. Alas, it's an unverifiable (by the datetime implementation) requirement, but so it goes.
-
Tim Peters yazdı
find a more elegant algorithm (OTOH, the hairy new implementation allows user-written tzinfo classes to be elegant, so it's a big win even if astimezone() remains hairy). Darn! I've only got 10 minutes left to get falling-down drunk! I suppose I'll have to smoke crack instead now.
-
- 31 Ara, 2002 1 kayıt (commit)
-
-
Tim Peters yazdı
an idea from Guido. This restores that the datetime implementation never passes a datetime d to a tzinfo method unless d.tzinfo is the tzinfo instance whose method is being called. That in turn allows enormous simplifications in user-written tzinfo classes (see the Python sandbox US.py and EU.py for fully fleshed-out examples). d.astimezone(tz) also raises ValueError now if d lands in the one hour of the year that can't be expressed in tz (this can happen iff tz models both standard and daylight time). That it used to return a nonsense result always ate at me, and it turned out that it seemed impossible to force a consistent nonsense result under the new implementation (which doesn't know anything about how tzinfo classes implement their methods -- it can only infer properties indirectly). Guido doesn't like this -- expect it to change. New tests of conversion between adjacent DST-aware timezones don't pass yet, and are commented out. Running the datetime tests in a loop under a debug build leaks 9 references per test run, but I don't believe the datetime code is the cause (it didn't leak the last time I changed the C code, and the leak is the same if I disable all the tests that invoke the only function that changed here). I'll pursue that next.
-
- 30 Ara, 2002 2 kayıt (commit)
-
-
Tim Peters yazdı
make the callers figure out the right tzinfo arguments to pass, instead of making the callees guess. The code is uglier this way, but it's less brittle (when the callee guesses, the caller can get surprised).
-
Tim Peters yazdı
of the timetz case. A tzinfo method will always see a datetimetz arg, or None, now. In the former case, it's still possible that it will get a datetimetz argument belonging to a different timezone. That will get fixed next.
-
- 27 Ara, 2002 3 kayıt (commit)
-
-
Tim Peters yazdı
-
Tim Peters yazdı
-
Tim Peters yazdı
operands have identical tzinfo members (meaning object identity -- "is"). I misunderstood the intent here, reading wrong conclusion into conflicting clues.
-
- 25 Ara, 2002 1 kayıt (commit)
-
-
Tim Peters yazdı
-
- 24 Ara, 2002 1 kayıt (commit)
-
-
Tim Peters yazdı
timetz.
-
- 23 Ara, 2002 1 kayıt (commit)
-
-
Tim Peters yazdı
-
- 22 Ara, 2002 4 kayıt (commit)
-
-
Tim Peters yazdı
be trusted with years before 1900, so now we raise ValueError if a date or datetime or datetimetz .strftime() method is called with a year before 1900.
-
Tim Peters yazdı
such that the datetime tests failed if the envar PYTHON2K was set. This is an utter mess, and the datetime module's strftime functions inherit it. I suspect that, regardless of the PYTHON2K setting, and regardless of platform limitations, the datetime strftime wrappers will end up delivering nonsense results (or bogus exceptions) for any year before 1900. I should probably just refuse to accept years earlier than that -- else we'll have to implement strftime() by hand.
-
Tim Peters yazdı
Also changed logic so that instances of user-defined subclasses of date, time, and datetime are called OFFSET_NAIVE instead of OFFSET_UNKNOWN.
-
Tim Peters yazdı
{timetz,datetimetz}.{utcoffset,dst}() now return a timedelta (or None) instead of an int (or None). tzinfo.{utcoffset,dst)() can now return a timedelta (or an int, or None). Curiously, this was much easier to do in the C implementation than in the Python implementation (which lives in the Zope3 code tree) -- the C code already had lots of hair to extract C ints from offset objects, and used C ints internally.
-
- 20 Ara, 2002 1 kayıt (commit)
-
-
Tim Peters yazdı
used that. wrap_strftime(): Removed the most irritating uses of buf. TestDate.test_ordinal_conversions(): The C implementation is fast enough that we can afford to check the endpoints of every year. Also added tm_yday tests at the endpoints.
-