Skip to content

Commit 175afd9

Browse files
arihant2mathyouknowone
authored andcommitted
time.timezone for windows
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
1 parent 72338d5 commit 175afd9

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎vm/src/stdlib/time.rs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,16 @@ mod decl {
178178
unsafe { super::c_timezone }
179179
}
180180

181+
#[cfg(target_env = "msvc")]
182+
#[cfg(not(target_arch = "wasm32"))]
183+
#[pyattr]
184+
fn timezone() -> i32 {
185+
let info = get_tz_info();
186+
// https://users.rust-lang.org/t/accessing-tzname-and-similar-constants-in-windows/125771/3
187+
(info.Bias + info.StandardBias) * 60
188+
}
189+
190+
181191
#[cfg(not(target_os = "freebsd"))]
182192
#[cfg(not(target_env = "msvc"))]
183193
#[cfg(not(target_arch = "wasm32"))]

0 commit comments

Comments
 (0)