# HG changeset patch # User Bryan O'Sullivan # Date 1370305245 25200 # Node ID 8b04e1344111ba696ff7cfaa59a48966b43332ee # Parent 78501209488a337ecbb17a04fa2f6fe2da1ac31d util: add an optional timestamp parameter to makedate This will be used by the upcoming shelve extension. diff -r 78501209488a -r 8b04e1344111 mercurial/util.py --- 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)