summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Allsopp <david.allsopp@metastack.com>2022-06-28 11:15:38 +0100
committerDavid Allsopp <david.allsopp@metastack.com>2022-10-14 13:26:51 +0100
commit671a92760444d5c4cd19ce85f9095efbfd5c2615 (patch)
treebdb2b4eeeaf30ec3d1500a4ec116c227325fd9aa
parent7eefbf8c757460f3a9bff91734a871d7b0a5e632 (diff)
downloadocaml-671a92760444d5c4cd19ce85f9095efbfd5c2615.tar.gz
C11 usage of [U]LARGE_INTEGER
For the mingw-w64 ports, we require a C11 compiler, which support anonymous structures and they're a default language extension in all supported versions of MSVC.
-rw-r--r--otherlibs/unix/times_win32.c5
-rw-r--r--runtime/win32.c8
2 files changed, 5 insertions, 8 deletions
diff --git a/otherlibs/unix/times_win32.c b/otherlibs/unix/times_win32.c
index 81312a5970..37fdef9d09 100644
--- a/otherlibs/unix/times_win32.c
+++ b/otherlibs/unix/times_win32.c
@@ -20,10 +20,7 @@
static double to_sec(FILETIME ft) {
- ULARGE_INTEGER tmp;
-
- tmp.u.LowPart = ft.dwLowDateTime;
- tmp.u.HighPart = ft.dwHighDateTime;
+ ULARGE_INTEGER tmp = {{ft.dwLowDateTime, ft.dwHighDateTime}};
/* convert to seconds:
GetProcessTimes returns number of 100-nanosecond intervals */
diff --git a/runtime/win32.c b/runtime/win32.c
index fc254bf174..fe4ef172db 100644
--- a/runtime/win32.c
+++ b/runtime/win32.c
@@ -1081,11 +1081,11 @@ CAMLexport clock_t caml_win32_clock(void)
return (clock_t)(-1);
}
- tmp.u.LowPart = stime.dwLowDateTime;
- tmp.u.HighPart = stime.dwHighDateTime;
+ tmp.LowPart = stime.dwLowDateTime;
+ tmp.HighPart = stime.dwHighDateTime;
total = tmp.QuadPart;
- tmp.u.LowPart = utime.dwLowDateTime;
- tmp.u.HighPart = utime.dwHighDateTime;
+ tmp.LowPart = utime.dwLowDateTime;
+ tmp.HighPart = utime.dwHighDateTime;
total += tmp.QuadPart;
/* total in 100-nanosecond intervals (1e7 / CLOCKS_PER_SEC) */