Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 6224:210ee6204a29
dates: fix fractional timezone display rounding bug
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 10 Mar 2008 02:54:37 -0500 |
parents | e75aab656f46 |
children | c3182eeb70ea |
comparison
equal
deleted
inserted
replaced
6223:bab6c8f2bb1a | 6224:210ee6204a29 |
---|---|
1530 number of seconds away from UTC. if timezone is false, do not | 1530 number of seconds away from UTC. if timezone is false, do not |
1531 append time zone to string.""" | 1531 append time zone to string.""" |
1532 t, tz = date or makedate() | 1532 t, tz = date or makedate() |
1533 s = time.strftime(format, time.gmtime(float(t) - tz)) | 1533 s = time.strftime(format, time.gmtime(float(t) - tz)) |
1534 if timezone: | 1534 if timezone: |
1535 s += timezone_format % (-tz / 3600, ((-tz % 3600) / 60)) | 1535 s += timezone_format % (int(-tz / 3600.0), ((-tz % 3600) / 60)) |
1536 return s | 1536 return s |
1537 | 1537 |
1538 def shortdate(date=None): | 1538 def shortdate(date=None): |
1539 """turn (timestamp, tzoff) tuple into iso 8631 date.""" | 1539 """turn (timestamp, tzoff) tuple into iso 8631 date.""" |
1540 return datestr(date, format='%Y-%m-%d', timezone=False) | 1540 return datestr(date, format='%Y-%m-%d', timezone=False) |