[flang-commits] [flang] [llvm] [flang-rt] Add implementation for date_and_time on Windows (PR #190174)

Michael Kruse via flang-commits flang-commits at lists.llvm.org
Thu Apr 2 08:01:57 PDT 2026


================
@@ -399,6 +410,41 @@ template <typename TM = struct tm> struct GmtOffsetHelper {
   };
 };
 
+#ifdef _WIN32
+struct timeval {
+  std::int64_t tv_sec;
+  std::int64_t tv_usec;
+};
+
+// gettimeofday half-implementation for win32; ignore the timezone as we don't
+// use it anyway
+int gettimeofday(timeval *tv, void *) {
----------------
Meinersbur wrote:

```suggestion
static int gettimeofday(timeval *tv, void *) {
```

If anything else in the address space also defines their own `gettimeofday` for Windows, this would otherwise violate the ODR.

https://github.com/llvm/llvm-project/pull/190174


More information about the flang-commits mailing list