Browse Source

mktime support fixed timezone

Meco Man 4 years ago
parent
commit
b74022e2c4
1 changed files with 7 additions and 1 deletions
  1. 7 1
      components/libc/compilers/common/time.c

+ 7 - 1
components/libc/compilers/common/time.c

@@ -234,7 +234,13 @@ RTM_EXPORT(localtime);
 /* TODO: timezone */
 time_t mktime(struct tm * const t)
 {
-    return timegm(t);
+    time_t timestamp;
+    int utc_plus;
+
+    utc_plus = 8; /* GMT: UTC+8 */
+    timestamp = timegm(t);
+    timestamp = timestamp - 3600 * utc_plus;
+    return timestamp;
 }
 RTM_EXPORT(mktime);