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 <gits...@pobox.com>
---

 * A simple preliminary clean-up while we are in the vicinity.  We
   may want to use time_t throughout the codepath and turn it into
   ulong at the very last, but that would be a separate topic.

 date.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/date.c b/date.c
index 782de95..01fd73f 100644
--- a/date.c
+++ b/date.c
@@ -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,8 +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;
-- 
2.4.0-rc2-165-g862640d

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to