Crates.io | timelib |
lib.rs | timelib |
version | |
source | src |
created_at | 2023-05-07 20:11:56.091042 |
updated_at | 2024-12-01 23:15:56.055581 |
description | A small Rust wrapper around the timelib library. |
homepage | https://github.com/westy92/timelib-rust |
repository | https://github.com/westy92/timelib-rust.git |
max_upload_size | |
id | 859349 |
Cargo.toml error: | TOML parse error at line 29, column 1 | 29 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Timelib for Rust is a small Rust wrapper around the timelib library that is used to power PHP and MongoDB.
You can install with:
cargo add timelib
let tz = timelib::Timezone::parse("America/Chicago").expect("Error parsing timezone!");
timelib::strtotime("tomorrow", None, &tz);
timelib::strtotime("next tuesday", Some(1654318823), &tz);
View the tests for more examples.
The genereated re2c
outputs are bundled and automatically used. If you wish to generate these files yourself, do the following:
re2c
. You can install it easily on all major platforms:
apt-get install re2c
brew install re2c
choco install re2c
re2c
feature:
timelib = { version = "0.3", features = ["re2c"] }
Make sure to check out all submodules.
Initial clone:
git clone --recurse-submodules https://github.com/westy92/timelib-rust
Post-clone:
git submodule init && git submodule update
You should now be able to run cargo build
and cargo test
.
If using the re2c
feature, make sure to install re2c
as described above. i.e. cargo test --features re2c
.
git submodule update --remote
Make sure to regenerate the re2c outputs and copy them to pregenerated/
.
cd ext/timelib/
make parse_date.c parse_iso_intervals.c
cp parse_date.c ../../pregenerated/
cp parse_iso_intervals.c ../../pregenerated/
Remove --dry-run
to publish for real.
cargo publish --dry-run