summaryrefslogtreecommitdiffstats
path: root/crypto/bio
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2012-12-16 19:02:59 +0000
committerAndy Polyakov <appro@openssl.org>2012-12-16 19:02:59 +0000
commitf469880c611b6b3a981f78a8e4309a8f337904ff (patch)
tree370febaff6ab62b64cfa3af3aba3a9ab719fb759 /crypto/bio
parentbbdfbacdef1c90a8ea7e7056266ae0f2fd9b14d6 (diff)
d1_lib.c,bss_dgram.c: eliminate dependency on _ftime.
Diffstat (limited to 'crypto/bio')
-rw-r--r--crypto/bio/bss_dgram.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/crypto/bio/bss_dgram.c b/crypto/bio/bss_dgram.c
index 7b87a043c4..d121386a52 100644
--- a/crypto/bio/bss_dgram.c
+++ b/crypto/bio/bss_dgram.c
@@ -1895,11 +1895,15 @@ int BIO_dgram_non_fatal_error(int err)
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(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINCE)
+ 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);