Use UTC to heck certificate validity
diff --git a/ChangeLog b/ChangeLog
index bb08fcd..8c064ad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
    * Work around a bug of the version of Clang shipped by Apple with Mavericks
      that prevented bignum.c from compiling. (Reported by Rafael Baptista.)
    * Improvements to tests/Makefile, contributed by Oden Eriksson.
+   * Use UTC time to check certificate validity.
 
 Security
    * Forbid change of server certificate during renegotiation to prevent
diff --git a/library/x509parse.c b/library/x509parse.c
index 085a3cf..f3e7831 100644
--- a/library/x509parse.c
+++ b/library/x509parse.c
@@ -3083,7 +3083,7 @@
 #if defined(_WIN32)
     SYSTEMTIME st;
 
-    GetLocalTime(&st);
+    GetSystemTime(&st);
 
     now->year = st.wYear;
     now->mon = st.wMonth;
@@ -3096,7 +3096,7 @@
     time_t tt;
 
     tt = time( NULL );
-    localtime_r( &tt, &lt );
+    gmtime_r( &tt, &lt );
 
     now->year = lt.tm_year + 1900;
     now->mon = lt.tm_mon + 1;