summaryrefslogtreecommitdiffstats
path: root/ssl/d1_lib.c
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2013-01-19 21:23:13 +0100
committerAndy Polyakov <appro@openssl.org>2014-02-01 22:48:56 +0100
commit2cc5142fb13e00e4c11179b156fdcec7cd4cde77 (patch)
treea8139bbecbffdc23c2b0abbc940265667b05d7ed /ssl/d1_lib.c
parentd451ece4e7edce8c954daa084c83686647dcda0f (diff)
Improve WINCE support.
Submitted by: Pierre Delaage (cherry picked from commit a006fef78e56b078549a80f4bb4518b6a02eba84) Resolved conflicts: crypto/bio/bss_dgram.c ssl/d1_lib.c util/pl/VC-32.pl
Diffstat (limited to 'ssl/d1_lib.c')
-rw-r--r--ssl/d1_lib.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/ssl/d1_lib.c b/ssl/d1_lib.c
index d372a61bea..2b066e0165 100644
--- a/ssl/d1_lib.c
+++ b/ssl/d1_lib.c
@@ -62,7 +62,7 @@
#include <openssl/objects.h>
#include "ssl_locl.h"
-#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS)
+#if defined(OPENSSL_SYS_VMS)
#include <sys/timeb.h>
#endif
@@ -481,11 +481,15 @@ int dtls1_handle_timeout(SSL *s)
static void get_current_time(struct timeval *t)
{
-#ifdef OPENSSL_SYS_WIN32
- struct _timeb tb;
- _ftime(&tb);
- t->tv_sec = (long)tb.time;
- t->tv_usec = (long)tb.millitm * 1000;
+#if defined(_WIN32)
+ SYSTEMTIME st;
+ union { unsigned __int64 ul; FILETIME ft; } now;
+
+ GetSystemTime(&st);
+ SystemTimeToFileTime(&st,&now.ft);
+ now.ul -= 116444736000000000UI64; /* re-bias to 1/1/1970 */
+ t->tv_sec = (long)(now.ul/10000000);
+ t->tv_usec = ((int)(now.ul%10000000))/10;
#elif defined(OPENSSL_SYS_VMS)
struct timeb tb;
ftime(&tb);