Message107169
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. |
|
Date |
User |
Action |
Args |
2010-06-06 01:15:12 | belopolsky | set | recipients:
+ belopolsky, zooko, amaury.forgeotdarc, mark.dickinson, djc, hodgestar, pr0gg3d, aht |
2010-06-06 01:15:11 | belopolsky | set | messageid: <1275786911.49.0.0539493509912.issue6280@psf.upfronthosting.co.za> |
2010-06-06 01:15:09 | belopolsky | link | issue6280 messages |
2010-06-06 01:15:09 | belopolsky | create | |
|