##// END OF EJS Templates
util.datestr: use divmod()...
Gregory Szorc -
r27066:6f1f8e88 default
parent child Browse files
Show More
@@ -1367,9 +1367,10 b" def datestr(date=None, format='%a %b %d "
1367 if "%1" in format or "%2" in format or "%z" in format:
1367 if "%1" in format or "%2" in format or "%z" in format:
1368 sign = (tz > 0) and "-" or "+"
1368 sign = (tz > 0) and "-" or "+"
1369 minutes = abs(tz) // 60
1369 minutes = abs(tz) // 60
1370 q, r = divmod(minutes, 60)
1370 format = format.replace("%z", "%1%2")
1371 format = format.replace("%z", "%1%2")
1371 format = format.replace("%1", "%c%02d" % (sign, minutes // 60))
1372 format = format.replace("%1", "%c%02d" % (sign, q))
1372 format = format.replace("%2", "%02d" % (minutes % 60))
1373 format = format.replace("%2", "%02d" % r)
1373 try:
1374 try:
1374 t = time.gmtime(float(t) - tz)
1375 t = time.gmtime(float(t) - tz)
1375 except ValueError:
1376 except ValueError:
General Comments 0
You need to be logged in to leave comments. Login now