STINNER Victor <victor.stin...@haypocalc.com> added the comment: > there is no easy way to convert it into "seconds since the epoch"
Ah yes, it remembers me that Alexander rejected my .totimestamp() patch (#2736) because he considers that "Converting datetime values to float is easy": (dt - datetime(1970, 1, 1)) / timedelta(seconds=1) I still think that this formula is *not* trivial, and must be a builtin method. For example, the formula is different if your datetime object if an aware instance: (dt - datetime(1970, 1, 1, tzinfo=timezone.utc)) / timedelta(seconds=1) When do you need to convert file timestamps to epoch? If we use datetime in os.stat output, we should also accept it as input (e.g. for os.utime). > any broken-down time has issues of time stamp ordering in > the duplicate hour of switching from DST to normal time I understand that it is an issue of the datetime module. Can it be solved, or is there a design issue in the module? > time zone support is flaky-to-nonexistent in the datetime module Python 3.3 has now a builtin implementation of fixed timezones, but yes, there are still things to be improved (e.g. support timezone names like "CET"). -- I don't have a strong opinion on this issue, I just wanted to know why datetime cannot be used for this issue. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11457> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com