#local #timezone #time

clia-local-offset

Get current local timezone offset simplely

1 unstable release

0.1.0 Oct 22, 2022

#533 in Date and time

Download history 53/week @ 2024-03-11 51/week @ 2024-03-18 92/week @ 2024-03-25 87/week @ 2024-04-01 46/week @ 2024-04-08 81/week @ 2024-04-15 118/week @ 2024-04-22 87/week @ 2024-04-29 63/week @ 2024-05-06 61/week @ 2024-05-13 53/week @ 2024-05-20 50/week @ 2024-05-27 87/week @ 2024-06-03 40/week @ 2024-06-10 50/week @ 2024-06-17 56/week @ 2024-06-24

237 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