mercurial/util.py
changeset 28826 59dd920c0ddc
parent 28825 87c6ad2251d8
child 28832 f5ff10f6fa6b
equal deleted inserted replaced
28825:87c6ad2251d8 28826:59dd920c0ddc
  1580     return timestamp, tz
  1580     return timestamp, tz
  1581 
  1581 
  1582 def datestr(date=None, format='%a %b %d %H:%M:%S %Y %1%2'):
  1582 def datestr(date=None, format='%a %b %d %H:%M:%S %Y %1%2'):
  1583     """represent a (unixtime, offset) tuple as a localized time.
  1583     """represent a (unixtime, offset) tuple as a localized time.
  1584     unixtime is seconds since the epoch, and offset is the time zone's
  1584     unixtime is seconds since the epoch, and offset is the time zone's
  1585     number of seconds away from UTC. if timezone is false, do not
  1585     number of seconds away from UTC."""
  1586     append time zone to string."""
       
  1587     t, tz = date or makedate()
  1586     t, tz = date or makedate()
  1588     if "%1" in format or "%2" in format or "%z" in format:
  1587     if "%1" in format or "%2" in format or "%z" in format:
  1589         sign = (tz > 0) and "-" or "+"
  1588         sign = (tz > 0) and "-" or "+"
  1590         minutes = abs(tz) // 60
  1589         minutes = abs(tz) // 60
  1591         q, r = divmod(minutes, 60)
  1590         q, r = divmod(minutes, 60)