Crates.io | libtz |
lib.rs | libtz |
version | 0.1.1 |
source | src |
created_at | 2023-01-25 16:46:23.758177 |
updated_at | 2023-01-28 22:41:09.243752 |
description | Idiomatic Rust interface for libtz-sys |
homepage | |
repository | https://github.com/caldwell/libtz |
max_upload_size | |
id | 767611 |
size | 15,196 |
Idiomatic Rust interface for IANA's libtz (git repository) via libtz-sys.
Links: [Documentation] [Git Repository] [Crates.io]
Add this to your Cargo.toml
:
[dependencies]
libtz = "0.1.1"
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(())
This is young code and I'm not sure about the finaly interface yet. It may change rapidly.
Copyright © 2023 David Caldwell david@porkrind.org
MIT Licensed. See LICENSE.md for details.