This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author belopolsky
Recipients Arfrever, barry, belopolsky, lemburg, pitrou, thomir, veebers
Date 2014-10-15.01:45:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1413337511.43.0.0593761173481.issue22627@psf.upfronthosting.co.za>
In-reply-to
Content
Your code as good as your timezone library, but you should realize that by discarding tzinfo you are making your "local_stamp" ambiguous.

I am not familiar with dateutil.tz, but pytz I believe uses some tricks to make sure astimezone() result remembers the isdst flag.

If you API requires naive local datetime objects, you need to carry isdst flag separately if you want to disambiguate between  2014-04-06 02:00 NZST and 2014-04-06 02:00 NZDT.  On top of that, you will not be able to use datetime.timestamp() method and will have to use time.mktime or whatever equivalent utility your timezone library provides.

Note that I was against adding datetime.timestamp() for this specific reason: it is supposed to be inverse of datetime.fromtimestamp(), but since the later is not monotonic, no such inverse exists in the strict mathematical sense.  See msg133039 in issue 2736.

BTW, if you open a feature request to add isdst=-1 optional argument to datetime.timestamp(), you will have my +1.
History
Date User Action Args
2014-10-15 01:45:11belopolskysetrecipients: + belopolsky, lemburg, barry, pitrou, Arfrever, thomir, veebers
2014-10-15 01:45:11belopolskysetmessageid: <1413337511.43.0.0593761173481.issue22627@psf.upfronthosting.co.za>
2014-10-15 01:45:11belopolskylinkissue22627 messages
2014-10-15 01:45:10belopolskycreate