Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/werdl/thetime
A simple Rust library for dealing with the time, both NTP and System. Depends on chrono
https://github.com/werdl/thetime
crate ntp rust time
Last synced: about 7 hours ago
JSON representation
A simple Rust library for dealing with the time, both NTP and System. Depends on chrono
- Host: GitHub
- URL: https://github.com/werdl/thetime
- Owner: werdl
- License: apache-2.0
- Created: 2024-01-03T08:27:48.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-02-13T10:13:11.000Z (9 months ago)
- Last Synced: 2024-10-31T11:51:53.663Z (18 days ago)
- Topics: crate, ntp, rust, time
- Language: Rust
- Homepage:
- Size: 84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# thetime
[![GitHub Actions][gh-image]][gh-checks]
[![crates.io][cratesio-image]][cratesio]
[![thetime on docs.rs][docsrs-image]][docsrs][gh-image]: https://github.com/werdl/thetime/actions/workflows/rust.yml/badge.svg
[gh-checks]: https://github.com/werdl/thetime/actions?query=workflow%20rust
[cratesio-image]: https://img.shields.io/crates/v/thetime.svg
[cratesio]: https://crates.io/crates/thetime
[docsrs-image]: https://docs.rs/thetime/badge.svg
[docsrs]: https://docs.rs/thetime
## Simple Rust library for time
- builds on top of std (almost exclusively `core`), chrono and time
- very simple and intuitive to use
- wraps some very useful functions that are usually buried deep in modules
- has extensive support for unusual epochs
- Fully supports without overflow, as the core data is stored as `u64`s, times since 01-01-1601, and up to, in my testing, "a+262143-01-01## Features
### ntp
- Default: `true`
- includes: `Ntp` struct
## Which traits you need
```rust
// Basic functionality
use thetime::{System, Ntp, Time};// Diff functions
use thetime::{System, Ntp, Time, TimeDiff};// String direct strptime
use thetime::{System, Ntp, Time, StrTime};// Timestamp int conversion
use thetime::{System, Ntp, Time, IntTime}// Timezones
use thetime::Tz;
```
## Utilities provided
- full docs at [docs.rs/thetime](https://docs.rs/thetime)
### List
- NTP server pinging
- System time grabbing
- time diff functions
- string to time structs
- timestamps as integers to time structs
- strptime and strftime
- convienent `now` method in the root for easy access
- various epochs
> - 01-01-1904 (MacOS)
> - 01-01-2001 (MacOS Absolute)
> - 01-01-1601 (Windows, measured in 100ns chunks)
> - 01-01-1960 (SAS 4GL)
> - 01-01-1601 (Webkit, measured in μs)