Alexander Belopolsky <[email protected]> added the comment:
With recent enhancements to datetime module, timegm has become a 1-liner:
EPOCH = 1970
_EPOCH_DATETIME = datetime.datetime(EPOCH, 1, 1)
_SECOND = datetime.timedelta(seconds=1)
def timegm(tuple):
"""Unrelated but handy function to calculate Unix timestamp from GMT."""
return (datetime.datetime(*tuple[:6]) - _EPOCH_DATETIME) // _SECOND
I suggest committing modernized implementation to serve as a reference and
encourage people to use datetime module and datetime objects instead of time
module and time tuples.
----------
assignee: -> belopolsky
nosy: +belopolsky, mark.dickinson -Alexander.Belopolsky
priority: normal -> low
stage: needs patch -> commit review
Added file: http://bugs.python.org/file17566/issue6280-calendar.diff
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue6280>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com