On Tue, Jun 5, 2012 at 9:45 AM, Guido van Rossum <gu...@python.org> wrote:
> TZ-less datetimes aren't going away and have
> plenty of use in contexts where the tz is either universally known or
> irrelevant.

I agree, but in these contexts naive datetime objects almost always
represent local time in some "universally known or irrelevant"
timezone.   I rarely see people use naive datetime objects to
represent UTC time and with timezone.utc added to datetime module
already the cost of supplying tzinfo to UTC datetime objects is low.

Based on tracker comments, I believe users ask for the following function:

    def timestamp(self, dst=-1):
        "Return POSIX timestamp as float"
        if self.tzinfo is None:
            return _time.mktime((self.year, self.month, self.day,
                                 self.hour, self.minute, self.second,
                                 -1, -1, dst)) + self.microsecond / 1e6
        else:
            return (self - _EPOCH).total_seconds()

You seem to advocate for

    def utctimestamp(self):
            return (self - _EPOCH).total_seconds()

in addition or instead of timestamp().  In mxDT, utctimestamp() is
called gmticks().

Is this an accurate summary?
_______________________________________________
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

Reply via email to