Mercurial > hg
diff mercurial/util.py @ 1991:a8a618c57690
merge with self
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Thu, 23 Mar 2006 23:55:51 +0100 |
parents | 4b0535c678d6 04c17fc39c84 |
children | 6328445b0e71 |
line wrap: on
line diff
--- a/mercurial/util.py Thu Mar 23 23:39:53 2006 +0100 +++ b/mercurial/util.py Thu Mar 23 23:55:51 2006 +0100 @@ -751,15 +751,16 @@ tz = time.timezone return time.mktime(lt), tz -def datestr(date=None, format='%a %b %d %H:%M:%S %Y'): +def datestr(date=None, format='%a %b %d %H:%M:%S %Y', timezone=True): """represent a (unixtime, offset) tuple as a localized time. unixtime is seconds since the epoch, and offset is the time zone's - number of seconds away from UTC.""" + number of seconds away from UTC. if timezone is false, do not + append time zone to string.""" t, tz = date or makedate() - return ("%s %+03d%02d" % - (time.strftime(format, time.gmtime(float(t) - tz)), - -tz / 3600, - ((-tz % 3600) / 60))) + s = time.strftime(format, time.gmtime(float(t) - tz)) + if timezone: + s += " %+03d%02d" % (-tz / 3600, ((-tz % 3600) / 60)) + return s def shortuser(user): """Return a short representation of a user name or email address."""