Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/softprops/unisecs
🕐 unix time seconds
https://github.com/softprops/unisecs
epoch-time unix
Last synced: about 2 months ago
JSON representation
🕐 unix time seconds
- Host: GitHub
- URL: https://github.com/softprops/unisecs
- Owner: softprops
- License: mit
- Created: 2019-04-07T18:14:34.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-27T04:48:05.000Z (almost 5 years ago)
- Last Synced: 2024-10-11T12:41:09.128Z (3 months ago)
- Topics: epoch-time, unix
- Language: Rust
- Homepage:
- Size: 748 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# unisecs [![Build Status](https://travis-ci.org/softprops/unisecs.svg?branch=master)](https://travis-ci.org/softprops/unisecs) [![Coverage Status](https://coveralls.io/repos/github/softprops/unisecs/badge.svg)](https://coveralls.io/github/softprops/unisecs) [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE) [![crates.io](https://img.shields.io/crates/v/unisecs.svg)](https://crates.io/crates/unisecs) [![Released API docs](https://docs.rs/unisecs/badge.svg)](http://docs.rs/unisecs) [![Master API docs](https://img.shields.io/badge/docs-master-green.svg)](https://softprops.github.io/unisecs)
> Unix epoch time representation that anyone can wear
## 🤔 About
Why not [`std::time`](https://doc.rust-lang.org/std/time/index.html)? Rust's `std::time` package provides two representations of time `SystemTime` and `Instant`. Often times you will need to work with an api that requires specifically [unix time](https://en.wikipedia.org/wiki/Unix_time) which typically is represented in terms of seconds. `std::time` representations are general purpose can can be made to represent unix time but not in a very straightforward or ergonomic way.
This crate does focuses specifically on that in addition to represented subsecond time for the purposes of capturing a more accuate measurement of a duration.
Unix seconds is a type of duration, anchored from a starting point of `00:00:00 UTC Thursday, 1 January 1970`. On most unix-based systems you can get this time on the command line with `date +%s`. This crate aims to provide similiar convenience in addition to having good interop with other features in `std::time` module.
## 📦 Install
In your Cargo.toml file, add the following under the [dependencies] heading
```toml
unisecs = "0.1"
```## Usage
```rust
fn main() {
println!(
"{}", unisecs::Seconds::now()
);
}
```Doug Tangren (softprops) 2019