util: add an optional timestamp parameter to makedate
authorBryan O'Sullivan <bryano@fb.com>
Mon, 03 Jun 2013 17:20:45 -0700
changeset 19287 8b04e1344111
parent 19286 78501209488a
child 19288 ec367f203cb5
util: add an optional timestamp parameter to makedate This will be used by the upcoming shelve extension.
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)