summaryrefslogtreecommitdiff
path: root/date.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-07-11 10:44:14 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-07-11 10:44:14 -0700
commit0c72d6da31dd6ffce56989e4bcbd1b8650b1ef25 (patch)
tree28ec9bc02f2918c704abdf1b8f6efb5cf9fd1b05 /date.c
parentMerge branch 'js/mingw-parameter-less-c-functions' into maint (diff)
parentlocal_tzoffset: detect errors from tm_to_time_t (diff)
downloadtgif-0c72d6da31dd6ffce56989e4bcbd1b8650b1ef25.tar.xz
Merge branch 'jk/tzoffset-fix' into maint
The internal code used to show local timezone offset is not prepared to handle timestamps beyond year 2100, and gave a bogus offset value to the caller. Use a more benign looking +0000 instead and let "git log" going in such a case, instead of aborting. * jk/tzoffset-fix: local_tzoffset: detect errors from tm_to_time_t t0006: test various date formats t0006: rename test-date's "show" to "relative"
Diffstat (limited to 'date.c')
-rw-r--r--date.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/date.c b/date.c
index 7c9f76998a..4c7aa9ba85 100644
--- a/date.c
+++ b/date.c
@@ -74,6 +74,8 @@ static int local_tzoffset(unsigned long time)
localtime_r(&t, &tm);
t_local = tm_to_time_t(&tm);
+ if (t_local == -1)
+ return 0; /* error; just use +0000 */
if (t_local < t) {
eastwest = -1;
offset = t - t_local;