diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-04-15 08:43:58 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-04-15 10:25:05 -0700 |
commit | 7fcec48da90f95dc64268ebd4b3073ae9487fe4e (patch) | |
tree | 297d0362b45086040278423d701ceaeee770210a /date.c | |
parent | 282616c72d1d08a77ca4fe1186cb708c38408d87 (diff) | |
download | git-7fcec48da90f95dc64268ebd4b3073ae9487fe4e.tar.gz |
parse_date_basic(): return early when given a bogus timestamp
When the input does not have GMT timezone offset, the code computes
it by computing the local and GMT time for the given timestamp. But
there is no point doing so if the given timestamp is known to be a
bogus one.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'date.c')
-rw-r--r-- | date.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -696,6 +696,9 @@ int parse_date_basic(const char *date, unsigned long *timestamp, int *offset) /* mktime uses local timezone */ *timestamp = tm_to_time_t(&tm); + if (*timestamp == -1) + return -1; + if (*offset == -1) { time_t temp_time = mktime(&tm); if ((time_t)*timestamp > temp_time) { @@ -705,9 +708,6 @@ int parse_date_basic(const char *date, unsigned long *timestamp, int *offset) } } - if (*timestamp == -1) - return -1; - if (!tm_gmt) *timestamp -= *offset * 60; return 0; /* success */ |