Show More
@@ -909,8 +909,14 b" def strdate(string, format='%a %b %d %H:" | |||||
909 | tz = int(tz) |
|
909 | tz = int(tz) | |
910 | offset = - 3600 * (tz / 100) - 60 * (tz % 100) |
|
910 | offset = - 3600 * (tz / 100) - 60 * (tz % 100) | |
911 | else: |
|
911 | else: | |
912 |
date, offset = string, |
|
912 | date, offset = string, None | |
913 |
|
|
913 | timetuple = time.strptime(date, format) | |
|
914 | localunixtime = int(calendar.timegm(timetuple)) | |||
|
915 | if offset is None: | |||
|
916 | # local timezone | |||
|
917 | unixtime = int(time.mktime(timetuple)) | |||
|
918 | offset = unixtime - localunixtime | |||
|
919 | else: | |||
914 | unixtime = localunixtime + offset |
|
920 | unixtime = localunixtime + offset | |
915 | return unixtime, offset |
|
921 | return unixtime, offset | |
916 |
|
922 |
@@ -21,13 +21,13 b' export TZ' | |||||
21 | # PST=UTC-8 / PDT=UTC-7 |
|
21 | # PST=UTC-8 / PDT=UTC-7 | |
22 | hg debugrebuildstate |
|
22 | hg debugrebuildstate | |
23 | echo "a" > a |
|
23 | echo "a" > a | |
24 | hg ci -d "2006-07-15 13:30" -m "summer@UTC" |
|
24 | hg ci -d "2006-07-15 13:30" -m "summer@UTC-7" | |
25 | hg debugrebuildstate |
|
25 | hg debugrebuildstate | |
26 | echo "b" > a |
|
26 | echo "b" > a | |
27 | hg ci -d "2006-07-15 13:30 +0500" -m "summer@UTC+5" |
|
27 | hg ci -d "2006-07-15 13:30 +0500" -m "summer@UTC+5" | |
28 | hg debugrebuildstate |
|
28 | hg debugrebuildstate | |
29 | echo "c" > a |
|
29 | echo "c" > a | |
30 | hg ci -d "2006-01-15 13:30" -m "winter@UTC" |
|
30 | hg ci -d "2006-01-15 13:30" -m "winter@UTC-8" | |
31 | hg debugrebuildstate |
|
31 | hg debugrebuildstate | |
32 | echo "d" > a |
|
32 | echo "d" > a | |
33 | hg ci -d "2006-01-15 13:30 +0500" -m "winter@UTC+5" |
|
33 | hg ci -d "2006-01-15 13:30 +0500" -m "winter@UTC+5" |
@@ -13,9 +13,9 b' abort: impossible time zone offset: 1400' | |||||
13 | transaction abort! |
|
13 | transaction abort! | |
14 | rollback completed |
|
14 | rollback completed | |
15 | Sun Jan 15 13:30:00 2006 +0500 |
|
15 | Sun Jan 15 13:30:00 2006 +0500 | |
16 |
Sun Jan 15 13:30:00 2006 |
|
16 | Sun Jan 15 13:30:00 2006 -0800 | |
17 | Sat Jul 15 13:30:00 2006 +0500 |
|
17 | Sat Jul 15 13:30:00 2006 +0500 | |
18 |
Sat Jul 15 13:30:00 2006 |
|
18 | Sat Jul 15 13:30:00 2006 -0700 | |
19 | Sun Jun 11 00:26:40 2006 -0400 |
|
19 | Sun Jun 11 00:26:40 2006 -0400 | |
20 | Sat Apr 15 13:30:00 2006 +0200 |
|
20 | Sat Apr 15 13:30:00 2006 +0200 | |
21 | Sat Apr 15 13:30:00 2006 +0000 |
|
21 | Sat Apr 15 13:30:00 2006 +0000 |
General Comments 0
You need to be logged in to leave comments.
Login now