##// END OF EJS Templates
makedate: wrong timezone offset if DST rules changed this year (issue2511)...
Dmitry Panov -
r15505:ae04af1c stable
parent child Browse files
Show More
@@ -16,7 +16,7 b' hide platform-specific details from the '
16 from i18n import _
16 from i18n import _
17 import error, osutil, encoding
17 import error, osutil, encoding
18 import errno, re, shutil, sys, tempfile, traceback
18 import errno, re, shutil, sys, tempfile, traceback
19 import os, time, calendar, textwrap, signal
19 import os, time, datetime, calendar, textwrap, signal
20 import imp, socket, urllib
20 import imp, socket, urllib
21
21
22 if os.name == 'nt':
22 if os.name == 'nt':
@@ -900,16 +900,14 b' def filechunkiter(f, size=65536, limit=N'
900 yield s
900 yield s
901
901
902 def makedate():
902 def makedate():
903 lt = time.localtime()
903 ct = time.time()
904 if lt[8] == 1 and time.daylight:
904 if ct < 0:
905 tz = time.altzone
906 else:
907 tz = time.timezone
908 t = time.mktime(lt)
909 if t < 0:
910 hint = _("check your clock")
905 hint = _("check your clock")
911 raise Abort(_("negative timestamp: %d") % t, hint=hint)
906 raise Abort(_("negative timestamp: %d") % ct, hint=hint)
912 return t, tz
907 delta = (datetime.datetime.utcfromtimestamp(ct) -
908 datetime.datetime.fromtimestamp(ct))
909 tz = delta.days * 86400 + delta.seconds
910 return ct, tz
913
911
914 def datestr(date=None, format='%a %b %d %H:%M:%S %Y %1%2'):
912 def datestr(date=None, format='%a %b %d %H:%M:%S %Y %1%2'):
915 """represent a (unixtime, offset) tuple as a localized time.
913 """represent a (unixtime, offset) tuple as a localized time.
General Comments 0
You need to be logged in to leave comments. Login now