summaryrefslogtreecommitdiff
path: root/src/win32/sys_time.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/win32/sys_time.c')
-rw-r--r--src/win32/sys_time.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/win32/sys_time.c b/src/win32/sys_time.c
index 08da60b..f1ebd63 100644
--- a/src/win32/sys_time.c
+++ b/src/win32/sys_time.c
@@ -1,3 +1,5 @@
+#include <stdint.h>
+
#include "sys_time.h"
#ifndef STLINK_HAVE_SYS_TIME_H
@@ -5,21 +7,21 @@
#include <time.h>
/* Simple gettimeofday implementation without converting Windows time to Linux time */
-int gettimeofday(struct timeval *tv, struct timezone *tz) {
+int32_t gettimeofday(struct timeval *tv, struct timezone *tz) {
FILETIME ftime;
ULARGE_INTEGER ulint;
- static int tzflag = 0;
+ static int32_t tzflag = 0;
- if(NULL != tv) {
+ if (NULL != tv) {
GetSystemTimeAsFileTime(&ftime);
ulint.LowPart = ftime.dwLowDateTime;
ulint.HighPart = ftime.dwHighDateTime;
- tv->tv_sec = (long)(ulint.QuadPart / 10000000L);
- tv->tv_usec = (long)(ulint.QuadPart % 10000000L);
+ tv->tv_sec = (int32_t)(ulint.QuadPart / 10000000L);
+ tv->tv_usec = (int32_t)(ulint.QuadPart % 10000000L);
}
- if(NULL != tz) {
+ if (NULL != tz) {
if (!tzflag) {
_tzset();
tzflag++;
@@ -30,4 +32,5 @@ int gettimeofday(struct timeval *tv, struct timezone *tz) {
return 0;
}
+
#endif //STLINK_HAVE_SYS_TIME_H