From 0900a51f986f3ed736d9556b3296d37933018196 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 8 Nov 2015 15:09:41 +0100 Subject: fix(commit): respect daylight saving when computing utc-offset Related to #362 --- git/objects/commit.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'git/objects/commit.py') diff --git a/git/objects/commit.py b/git/objects/commit.py index 376b451d..d067b718 100644 --- a/git/objects/commit.py +++ b/git/objects/commit.py @@ -27,7 +27,10 @@ from git.compat import text_type from time import ( time, - altzone + daylight, + altzone, + timezone, + localtime ) import os from io import BytesIO @@ -327,7 +330,8 @@ class Commit(base.Object, Iterable, Diffable, Traversable, Serializable): # PARSE THE DATES unix_time = int(time()) - offset = altzone + is_dst = daylight and localtime().tm_isdst > 0 + offset = altzone if is_dst else timezone author_date_str = env.get(cls.env_author_date, '') if author_date: -- cgit v1.2.1