On Fri, Jun 8, 2012 at 11:06 PM, Guido van Rossum <gu...@python.org> wrote: > On Fri, Jun 8, 2012 at 2:08 PM, Alexander Belopolsky > <alexander.belopol...@gmail.com> wrote: .. >>>>> t = mktime((2010, 11, 7, 1, 0, 0, -1, -1, 0)) >>>>> for i in range(5): >> ... print(strftime("%T%z", localtime(t + i - 2))) >> ... >> 01:59:58-0400 >> 01:59:59-0400 >> 01:00:00-0500 >> 01:00:01-0500 >> 01:00:02-0500 >> >> As I explained at <http://bugs.python.org/msg109452>, it is not >> possible to reproduce this sequence using LocalTimezone. > > So LocalTimezone (or any named timezone that uses DST) should not be > used for this purpose. .. > I'm still unsure what problem you're trying to solve.
The problem is: produce a timestamp (e.g. RFC 3339) complete with timezone information corresponding to the current time or any other unambiguously defined time. This is exactly what my proposed datetime.localtime() function does. > Can we just > introduce LocalTimezone (or whatever name it should have) and let the > issue rest? No. LocalTimezone adresses a different problem and does not solve this one. If you generate a timestamp using datetime.now(LocalTimezone).strftime("... %z"), your timestamps will be wrong for one hour every year. Some users may tolerate this, but the problem is not hard to solve and I think datetime module should offer one obvious and correct way to do it. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com