mercurial/util.py
changeset 27066 6f1f8e88f036
parent 27016 448cbdab5883
child 27112 39c14e89b881
equal deleted inserted replaced
27065:93bcc73df8d5 27066:6f1f8e88f036
  1365         t = 0   # time.gmtime(lt) fails on Windows for lt < -43200
  1365         t = 0   # time.gmtime(lt) fails on Windows for lt < -43200
  1366         tz = 0
  1366         tz = 0
  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:
  1376         # time was out of range
  1377         # time was out of range
  1377         t = time.gmtime(sys.maxint)
  1378         t = time.gmtime(sys.maxint)