hgext/convert/common.py
changeset 17974 337d728e644f
parent 17413 97f1f22c2dba
child 18819 05acdf8e1f23
--- a/hgext/convert/common.py	Tue Nov 27 16:24:21 2012 -0800
+++ b/hgext/convert/common.py	Sun Nov 18 12:26:50 2012 -1000
@@ -5,7 +5,7 @@
 # This software may be used and distributed according to the terms of the
 # GNU General Public License version 2 or any later version.
 
-import base64, errno, subprocess, os
+import base64, errno, subprocess, os, datetime
 import cPickle as pickle
 from mercurial import util
 from mercurial.i18n import _
@@ -446,3 +446,10 @@
         if e.errno != errno.ENOENT:
             raise
     return m
+
+def makedatetimestamp(t):
+    """Like util.makedate() but for time t instead of current time"""
+    delta = (datetime.datetime.utcfromtimestamp(t) -
+             datetime.datetime.fromtimestamp(t))
+    tz = delta.days * 86400 + delta.seconds
+    return t, tz