This utility crate provides a single trait SystemTz
which exposes the system_tz()
method allowing to get the timezone
from the operating system.
Currently supported platforms include unix
, windows
and wasm
.
Valid timezones are represented with chrono_tz::Tz
which is the most common Rust standard, based on IANA Time Zone Database (Olson names).
On Microsoft Windows, because of its use of a special naming convention,
the method relies on WindowsZones
,
a dataset maintained by the Unicode Common Locale Data Repository (CLDR),
which is downloaded and built into a static global object during compilation.
The crate provides a very basic binary callable by the command-line which will print the timezone on invokation.
Refer to the official documentation
for installing the cargo
package manager, and then run the following command
from a terminal:
bash
$ cargo install system_tz
The interface doesn't require any argument.
bash
$ system_tz
Europe/Paris
Contributions to the project are most welcome. In particular, please let us known whether it works on your device so we can improve the implementation.
Pull request require agreement to the Developer's certificate of origin (DCO-1.1
).