comparison mercurial/util.py @ 28826:59dd920c0ddc

util: fix doc for datestr() timezone parameter was removed with c3182eeb70ea
author Adrian Buehlmann <adrian@cadifra.com>
date Fri, 08 Apr 2016 22:15:06 +0200
parents 87c6ad2251d8
children f5ff10f6fa6b
comparison
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)