|new 0.2.3||Mar 14, 2023|
|0.2.2||Nov 24, 2022|
|0.2.1||Aug 23, 2022|
|0.1.4||Aug 3, 2022|
|0.0.0-pre5||Jul 24, 2022|
#52 in Date and time
11,910 downloads per month
utcnow — Get the current unixtime in a no-std context
This library solves one question, and one question only: What's the time?
In UTC, and
according to the clock of the PC, tablet, toaster … the library runs on,
expressed as seconds + nanoseconds since
let now = utcnow().unwrap(); let seconds = now.as_secs(); let nanos = now.subsec_nanos();
For many target platforms this call cannot fail.
If this is true for the current target, then the constant
INFALLIBLE will be
If the target platform is not supported, then
utcnow() will always return an error instead of failing to compile.
Use the library with
default-features = false and without the feature
fallback to get a compile-time error instead.
std (enabled by default) is only needed if you need the
Error type to implement
If you have successfully tested one of the untested targets, then please tell me. And if not, then even more so!
If you know how to implement another target, then please open a pull request.
Supported and tested:
- Linux with Musl
(Probably) supported, but not actually tested:
Increasing the msrv for tier-2 or lower platforms will not be indicated as a breaking change to the semver version.
utcnow has the following optional features:
serde, which implements
arbitrary, which implements the
proptest, which implements the
quickcheck, which implements the
rkyv, which implements the
castaway, which implements the