#timezone #local #time

clia-local-offset

Get current local timezone offset simplely

1 unstable release

0.1.0 Oct 22, 2022

#577 in Date and time

Download history 307/week @ 2024-08-16 202/week @ 2024-08-23 102/week @ 2024-08-30 74/week @ 2024-09-06 83/week @ 2024-09-13 134/week @ 2024-09-20 61/week @ 2024-09-27 40/week @ 2024-10-04 59/week @ 2024-10-11 49/week @ 2024-10-18 38/week @ 2024-10-25 58/week @ 2024-11-01 26/week @ 2024-11-08 40/week @ 2024-11-15 50/week @ 2024-11-22 67/week @ 2024-11-29

193 downloads per month
Used in 8 crates (2 directly)

MIT license

4KB
50 lines

clia-local-offset

Get current local timezone offset simplely.

This crate uses tz-rs to obtain local timezone offset, and returns a time-rs UtcOffset.

Usage

use tracing_subscriber::fmt::time::OffsetTime;

// Local offset timezone init, and set time format.
let offset = clia_local_offset::current_local_offset()
    .expect("Can not get local offset!");

let timer = OffsetTime::new(
    offset,
    format_description!(
        "[year]-[month]-[day] [hour]:[minute]:[second].[subsecond digits:3]"
    ),
);

lib.rs:

Get current local timezone offset simplely.

Dependencies

~1MB
~17K SLoC