1. 24 Ock, 2003 1 kayıt (commit)
  2. 23 Ock, 2003 5 kayıt (commit)
    • Neal Norwitz's avatar
      Fix typo · 2fbe5378
      Neal Norwitz yazdı
      2fbe5378
    • Tim Peters's avatar
      SF bug 660872: datetimetz constructors behave counterintuitively (2.3a1). · 2a44a8d3
      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.
      2a44a8d3
    • Tim Peters's avatar
      Reimplemented datetime.now() to be useful. · 10cadce4
      Tim Peters yazdı
      10cadce4
    • Tim Peters's avatar
    • Tim Peters's avatar
      Bringing the code and test suite into line with doc and NEWS changes · 52dcce24
      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).
      52dcce24
  3. 20 Ock, 2003 1 kayıt (commit)
    • Tim Peters's avatar
      New rule for tzinfo subclasses handling both standard and daylight time: · 327098a6
      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.
      327098a6
  4. 11 Ock, 2003 2 kayıt (commit)
  5. 10 Ock, 2003 3 kayıt (commit)
  6. 08 Ock, 2003 3 kayıt (commit)
  7. 04 Ock, 2003 4 kayıt (commit)
  8. 02 Ock, 2003 5 kayıt (commit)
  9. 01 Ock, 2003 2 kayıt (commit)
    • Tim Peters's avatar
      A quicker astimezone() implementation, rehabilitating an earlier · f3615155
      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.
      f3615155
    • Tim Peters's avatar
      datetimetz_astimezone(): Speed optimizations -- although I'd rather · b5a16f33
      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.
      b5a16f33
  10. 31 Ara, 2002 1 kayıt (commit)
    • Tim Peters's avatar
      A new, and much hairier, implementation of astimezone(), building on · 521fc15e
      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.
      521fc15e
  11. 30 Ara, 2002 2 kayıt (commit)
  12. 27 Ara, 2002 3 kayıt (commit)
  13. 25 Ara, 2002 1 kayıt (commit)
  14. 24 Ara, 2002 1 kayıt (commit)
  15. 23 Ara, 2002 1 kayıt (commit)
  16. 22 Ara, 2002 4 kayıt (commit)
    • Tim Peters's avatar
      I give up: unless I write my own strftime by hand, datetime just can't · d6844155
      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.
      d6844155
    • Tim Peters's avatar
      Python's strftime implementation does strange things with the year, · 83b85f1d
      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.
      83b85f1d
    • Tim Peters's avatar
      classify_object(): Renamed more meaningfully, to classify_utcoffset(). · 14b69411
      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.
      14b69411
    • Tim Peters's avatar
      Implemented a Wiki suggestion: · 855fe88b
      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.
      855fe88b
  17. 20 Ara, 2002 1 kayıt (commit)