Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4a47a9c

Browse files
committed
BF: adjust mktime output for the local offset (Closegitpython-developers#218)
1 parent891b124 commit4a47a9c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

‎git/objects/util.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ def parse_date(string_date):
156156
fstruct=time.struct_time((dtstruct.tm_year,dtstruct.tm_mon,dtstruct.tm_mday,
157157
tstruct.tm_hour,tstruct.tm_min,tstruct.tm_sec,
158158
dtstruct.tm_wday,dtstruct.tm_yday,tstruct.tm_isdst))
159-
returnint(time.mktime(fstruct)),utctz_to_altz(offset)
159+
utctime=time.mktime(fstruct)
160+
# time.mktime returns local time, so we need to adjust it for local offset
161+
utctime-=time.altzoneiftime.daylightelsetime.timezone
162+
returnint(utctime),utctz_to_altz(offset)
160163
exceptValueError:
161164
continue
162165
# END exception handling

‎git/test/test_util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def assert_rval(rval, veri_time, offset=0):
102102
iso3= ("2005.04.07 22:13:11 -0000",0)
103103
alt= ("04/07/2005 22:13:11",0)
104104
alt2= ("07.04.2005 22:13:11",0)
105-
veri_time=1112904791# the time this represents
105+
veri_time=1112911991# the time this represents
106106
fordate,offsetin (rfc,iso,iso2,iso3,alt,alt2):
107107
assert_rval(parse_date(date),veri_time,offset)
108108
# END for each date type

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp