Mercurial > hg-stable
changeset 19286:78501209488a
util: rename ct variable in makedate to timestamp
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Mon, 03 Jun 2013 17:20:44 -0700 |
parents | feaf5749d7a4 |
children | 8b04e1344111 |
files | mercurial/util.py |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Mon Jun 03 17:20:37 2013 -0700 +++ b/mercurial/util.py Mon Jun 03 17:20:44 2013 -0700 @@ -998,14 +998,16 @@ yield s def makedate(): - ct = time.time() - if ct < 0: + '''Return the current time as a (unixtime, offset) tuple based off + the local timezone.''' + timestamp = time.time() + if timestamp < 0: hint = _("check your clock") - raise Abort(_("negative timestamp: %d") % ct, hint=hint) - delta = (datetime.datetime.utcfromtimestamp(ct) - - datetime.datetime.fromtimestamp(ct)) + raise Abort(_("negative timestamp: %d") % timestamp, hint=hint) + delta = (datetime.datetime.utcfromtimestamp(timestamp) - + datetime.datetime.fromtimestamp(timestamp)) tz = delta.days * 86400 + delta.seconds - return ct, tz + return timestamp, tz def datestr(date=None, format='%a %b %d %H:%M:%S %Y %1%2'): """represent a (unixtime, offset) tuple as a localized time.