From 262cc06075effe23b29b31e9e0c1f732bade35e0 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Thu, 28 Mar 2019 06:35:07 +0000 Subject: [PATCH] Fix ruby conformance test on mac --- ruby/ext/google/protobuf_c/upb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ruby/ext/google/protobuf_c/upb.c b/ruby/ext/google/protobuf_c/upb.c index deaa232319..c36cb0a6bb 100644 --- a/ruby/ext/google/protobuf_c/upb.c +++ b/ruby/ext/google/protobuf_c/upb.c @@ -14302,7 +14302,7 @@ static void start_timestamp_zone(upb_json_parser *p, const char *ptr) { static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) { size_t len; const char *buf; - int hours; + int hours = 0; int64_t seconds; const char *seconds_membername = "seconds"; @@ -14322,12 +14322,11 @@ static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) { if (buf[0] == '+') { hours = -hours; } - - p->tm.tm_hour += hours; } /* Normalize tm */ - seconds = mktime(&p->tm); + seconds = timegm(&p->tm); + seconds += 3600 * hours; /* Check timestamp boundary */ if (seconds < -62135596800) {