Kaydet (Commit) 97958cf3 authored tarafından Alexander Belopolsky's avatar Alexander Belopolsky

Undo r81988 code change leaving added test.

üst 43ca710a
......@@ -587,12 +587,17 @@ def formatstring(cols, colwidth=_colwidth, spacing=_spacing):
EPOCH = 1970
_EPOCH_DATETIME = datetime.datetime(EPOCH, 1, 1)
_SECOND = datetime.timedelta(seconds=1)
_EPOCH_ORD = datetime.date(EPOCH, 1, 1).toordinal()
def timegm(tuple):
"""Unrelated but handy function to calculate Unix timestamp from GMT."""
return (datetime.datetime(*tuple[:6]) - _EPOCH_DATETIME) // _SECOND
year, month, day, hour, minute, second = tuple[:6]
days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1
hours = days*24 + hour
minutes = hours*60 + minute
seconds = minutes*60 + second
return seconds
def main(args):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment