[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:56 PDT 2026
================
@@ -376,14 +375,26 @@ GetGmtOffset(const TM &tm, fallback_implementation) {
// return -HUGE to report that this information is not available.
const auto negHuge{-std::numeric_limits<Fortran::runtime::CppTypeFor<
Fortran::common::TypeCategory::Integer, KIND>>::max()};
-#ifdef _AIX
+#if defined _AIX
bool err{false};
auto diff{computeUTCDiff(tm, &err)};
if (err) {
return negHuge;
} else {
return diff;
}
+#elif defined _WIN32
+ DYNAMIC_TIME_ZONE_INFORMATION tzi;
+ std::uint32_t tzid{GetDynamicTimeZoneInformation(&tzi)};
+ if (tzid == TIME_ZONE_ID_INVALID) {
+ return negHuge;
+ }
+
+ std::int32_t bias{tzi.Bias};
+ bias += (tzid == TIME_ZONE_ID_DAYLIGHT ? tzi.DaylightBias : tzi.StandardBias);
+
+ // Bias is minutes behind GMT, and we need minuetes ahead.
----------------
Meinersbur wrote:
```suggestion
// Bias is minutes behind GMT, and we need minutes ahead.
```
https://github.com/llvm/llvm-project/pull/190174
More information about the flang-commits
mailing list