function to retrieve tz info on windows

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
This commit is contained in:
Ashwin Naren
2025-02-17 21:15:58 -08:00
committed by Jeong, YunWon
parent 517ffed401
commit 9856d94f2d
2 changed files with 12 additions and 0 deletions

View File

@@ -116,6 +116,7 @@ features = [
"Win32_Foundation",
"Win32_System_LibraryLoader",
"Win32_System_Threading",
"Win32_System_Time",
"Win32_UI_Shell",
]

View File

@@ -152,6 +152,17 @@ mod decl {
Ok(get_perf_time(vm)?.as_nanos())
}
#[cfg(target_env = "msvc")]
#[cfg(not(target_arch = "wasm32"))]
fn get_tz_info() -> Time::TIME_ZONE_INFORMATION {
let mut info = Time::TIME_ZONE_INFORMATION::default();
let info_ptr = &mut info as *mut Time::TIME_ZONE_INFORMATION;
let _ = unsafe {
Time::GetTimeZoneInformation(info_ptr)
};
info
}
// #[pyfunction]
// fn tzset() {
// unsafe { super::_tzset() };