Skip to content

Commit 9856d94

Browse files
arihant2mathyouknowone
authored andcommitted
function to retrieve tz info on windows
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
1 parent 517ffed commit 9856d94

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎vm/Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ features = [
116116
"Win32_Foundation",
117117
"Win32_System_LibraryLoader",
118118
"Win32_System_Threading",
119+
"Win32_System_Time",
119120
"Win32_UI_Shell",
120121
]
121122

‎vm/src/stdlib/time.rs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,17 @@ mod decl {
152152
Ok(get_perf_time(vm)?.as_nanos())
153153
}
154154

155+
#[cfg(target_env = "msvc")]
156+
#[cfg(not(target_arch = "wasm32"))]
157+
fn get_tz_info() -> Time::TIME_ZONE_INFORMATION {
158+
let mut info = Time::TIME_ZONE_INFORMATION::default();
159+
let info_ptr = &mut info as *mut Time::TIME_ZONE_INFORMATION;
160+
let _ = unsafe {
161+
Time::GetTimeZoneInformation(info_ptr)
162+
};
163+
info
164+
}
165+
155166
// #[pyfunction]
156167
// fn tzset() {
157168
// unsafe { super::_tzset() };

0 commit comments

Comments
 (0)