Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 32290:2959c3e986e0
py3: convert date and format arguments str before passing in time.strptime
time.strptime() raises ValueError if the arguments are not str.
Source Code: https://hg.python.org/cpython/file/3.5/Lib/_strptime.py#l307
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sat, 06 May 2017 04:51:25 +0530 |
parents | d74b0cff94a9 |
children | bd872f64a8ba |
comparison
equal
deleted
inserted
replaced
32289:770bbfdc9644 | 32290:2959c3e986e0 |
---|---|
1935 else: | 1935 else: |
1936 # We've found a specific time element, less specific time | 1936 # We've found a specific time element, less specific time |
1937 # elements are relative to today | 1937 # elements are relative to today |
1938 usenow = True | 1938 usenow = True |
1939 | 1939 |
1940 timetuple = time.strptime(date, format) | 1940 timetuple = time.strptime(encoding.strfromlocal(date), |
1941 encoding.strfromlocal(format)) | |
1941 localunixtime = int(calendar.timegm(timetuple)) | 1942 localunixtime = int(calendar.timegm(timetuple)) |
1942 if offset is None: | 1943 if offset is None: |
1943 # local timezone | 1944 # local timezone |
1944 unixtime = int(time.mktime(timetuple)) | 1945 unixtime = int(time.mktime(timetuple)) |
1945 offset = unixtime - localunixtime | 1946 offset = unixtime - localunixtime |