Mercurial > hg
changeset 19287:8b04e1344111
util: add an optional timestamp parameter to makedate
This will be used by the upcoming shelve extension.
author | Bryan O'Sullivan <bryano@fb.com> |
---|---|
date | Mon, 03 Jun 2013 17:20:45 -0700 |
parents | 78501209488a |
children | ec367f203cb5 |
files | mercurial/util.py |
diffstat | 1 files changed, 5 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Mon Jun 03 17:20:44 2013 -0700 +++ b/mercurial/util.py Mon Jun 03 17:20:45 2013 -0700 @@ -997,10 +997,11 @@ limit -= len(s) yield s -def makedate(): - '''Return the current time as a (unixtime, offset) tuple based off - the local timezone.''' - timestamp = time.time() +def makedate(timestamp=None): + '''Return a unix timestamp (or the current time) as a (unixtime, + offset) tuple based off the local timezone.''' + if timestamp is None: + timestamp = time.time() if timestamp < 0: hint = _("check your clock") raise Abort(_("negative timestamp: %d") % timestamp, hint=hint)