# HG changeset patch # User Bryan O'Sullivan # Date 2013-06-04 00:20:45 # Node ID 8b04e1344111ba696ff7cfaa59a48966b43332ee # Parent 78501209488a337ecbb17a04fa2f6fe2da1ac31d util: add an optional timestamp parameter to makedate This will be used by the upcoming shelve extension. diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -997,10 +997,11 @@ def filechunkiter(f, size=65536, limit=N 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)