3 unstable releases

0.1.1 Jan 28, 2023
0.1.0 Jan 26, 2023
0.0.0 Jan 25, 2023

#488 in Date and time

MIT license

15KB
211 lines

libtz

Idiomatic Rust interface for IANA's libtz (git repository) via libtz-sys.

Links: [Documentation] [Git Repository] [Crates.io]

Usage

Add this to your Cargo.toml:

[dependencies]
libtz = "0.1.1"

Example

use libtz::{Timezone, TimeT};
use std::time::{SystemTime, UNIX_EPOCH};

let tz = libtz::Timezone::default()?;
let tm = tz.localtime(SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() as TimeT)?;
println!("tm = {:?}", tm);
# Result::<(), Box<dyn std::error::Error>>::Ok(())

Status

This is young code and I'm not sure about the finaly interface yet. It may change rapidly.

License

Copyright © 2023 David Caldwell david@porkrind.org

MIT Licensed. See LICENSE.md for details.

Dependencies

~0.6–0.9MB
~15K SLoC