Debian Codegraph @

third_party/rust/time/src/sys/local_offset_at/mod.rs

raw
1 //! A method to obtain the local offset from UTC.
2
3 #![allow(clippy::missing_const_for_fn)]
4
5 #[cfg_attr(target_family = "windows", path = "windows.rs")]
6 #[cfg_attr(target_family = "unix", path = "unix.rs")]
7 #[cfg_attr(
8 all(
9 target_family = "wasm",
10 not(any(target_os = "emscripten", target_os = "wasi")),
11 feature = "wasm-bindgen"
12 ),
13 path = "wasm_js.rs"
14 )]
15 mod imp;
16
17 use crate::{OffsetDateTime, UtcOffset};
18
19 /// Attempt to obtain the system's UTC offset. If the offset cannot be determined, `None` is
20 /// returned.
21 pub(crate) fn local_offset_at(datetime: OffsetDateTime) -> Option<UtcOffset> {
22 // miri does not support tzset()
23 if cfg!(miri) {
24 None
25 } else {
26 imp::local_offset_at(datetime)
27 }
28 }