Show More
@@ -998,14 +998,16 b' def filechunkiter(f, size=65536, limit=N' | |||||
998 | yield s |
|
998 | yield s | |
999 |
|
999 | |||
1000 | def makedate(): |
|
1000 | def makedate(): | |
1001 | ct = time.time() |
|
1001 | '''Return the current time as a (unixtime, offset) tuple based off | |
1002 | if ct < 0: |
|
1002 | the local timezone.''' | |
|
1003 | timestamp = time.time() | |||
|
1004 | if timestamp < 0: | |||
1003 | hint = _("check your clock") |
|
1005 | hint = _("check your clock") | |
1004 |
raise Abort(_("negative timestamp: %d") % |
|
1006 | raise Abort(_("negative timestamp: %d") % timestamp, hint=hint) | |
1005 |
delta = (datetime.datetime.utcfromtimestamp( |
|
1007 | delta = (datetime.datetime.utcfromtimestamp(timestamp) - | |
1006 |
datetime.datetime.fromtimestamp( |
|
1008 | datetime.datetime.fromtimestamp(timestamp)) | |
1007 | tz = delta.days * 86400 + delta.seconds |
|
1009 | tz = delta.days * 86400 + delta.seconds | |
1008 |
return |
|
1010 | return timestamp, tz | |
1009 |
|
1011 | |||
1010 | def datestr(date=None, format='%a %b %d %H:%M:%S %Y %1%2'): |
|
1012 | def datestr(date=None, format='%a %b %d %H:%M:%S %Y %1%2'): | |
1011 | """represent a (unixtime, offset) tuple as a localized time. |
|
1013 | """represent a (unixtime, offset) tuple as a localized time. |
General Comments 0
You need to be logged in to leave comments.
Login now