瀏覽代碼

Fix ruby conformance test on mac

Bo Yang 6 年之前
父節點
當前提交
262cc06075
共有 1 個文件被更改,包括 3 次插入4 次删除
  1. 3 4
      ruby/ext/google/protobuf_c/upb.c

+ 3 - 4
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) {
 static bool end_timestamp_zone(upb_json_parser *p, const char *ptr) {
   size_t len;
   size_t len;
   const char *buf;
   const char *buf;
-  int hours;
+  int hours = 0;
   int64_t seconds;
   int64_t seconds;
   const char *seconds_membername = "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] == '+') {
     if (buf[0] == '+') {
       hours = -hours;
       hours = -hours;
     }
     }
-
-    p->tm.tm_hour += hours;
   }
   }
 
 
   /* Normalize tm */
   /* Normalize tm */
-  seconds = mktime(&p->tm);
+  seconds = timegm(&p->tm);
+  seconds += 3600 * hours;
 
 
   /* Check timestamp boundary */
   /* Check timestamp boundary */
   if (seconds < -62135596800) {
   if (seconds < -62135596800) {