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