[issue6280] calendar.timegm() belongs in time module, next to time.gmtime()
Alexander Belopolsky
report at bugs.python.org
Sun Jun 6 03:15:11 CEST 2010
Alexander Belopolsky <belopolsky at users.sourceforge.net> 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 <report at bugs.python.org>
<http://bugs.python.org/issue6280>
_______________________________________
More information about the Python-bugs-list
mailing list