comparison mercurial/util.py @ 6134:7b937b26adf7

Make annotae/grep print short dates with -q/--quiet. Move shortdate() from templatefilters to util to avoid code duplication.
author Thomas Arendsen Hein <thomas@intevation.de>
date Sat, 16 Feb 2008 13:33:38 +0100
parents 213ea6eed412
children be91a77b7f18
comparison
equal deleted inserted replaced
6133:779f2309d67a 6134:7b937b26adf7
1531 s = time.strftime(format, time.gmtime(float(t) - tz)) 1531 s = time.strftime(format, time.gmtime(float(t) - tz))
1532 if timezone: 1532 if timezone:
1533 s += timezone_format % (-tz / 3600, ((-tz % 3600) / 60)) 1533 s += timezone_format % (-tz / 3600, ((-tz % 3600) / 60))
1534 return s 1534 return s
1535 1535
1536 def shortdate(date=None):
1537 """turn (timestamp, tzoff) tuple into iso 8631 date."""
1538 return datestr(date, format='%Y-%m-%d', timezone=False)
1539
1536 def strdate(string, format, defaults=[]): 1540 def strdate(string, format, defaults=[]):
1537 """parse a localized time string and return a (unixtime, offset) tuple. 1541 """parse a localized time string and return a (unixtime, offset) tuple.
1538 if the string cannot be parsed, ValueError is raised.""" 1542 if the string cannot be parsed, ValueError is raised."""
1539 def timezone(string): 1543 def timezone(string):
1540 tz = string.split()[-1] 1544 tz = string.split()[-1]