#epoch #unix #timestamp #unixtime

epoch-timestamp

Boilerplate collection for epoch timestamping

1 stable release

1.0.0 Jul 14, 2020

#1353 in Data structures


Used in 2 crates

MIT license

3KB

epoch-timestamp

GitHub license

Boilerplate collection for epoch(unix) timestamping.

You can get the current time as an epoch timestamp as shown below.

let now = Epoch::now(); //return u64 

And if you want to make tomorrow's time a timestamp, you can do this.

let tomorrow = now + Epoch::day(1);

Epoch::day function converts 64 numbers passed as arguments to day units.

Other conversion functions are as follows.

Epoch::second(2); //2 seconds
Epoch::minute(3); //3 minutes
Epoch::hour(4); //4 hours
Epoch::day(5); //5 days
Epoch::week(6); //6 weeks
Epoch::year(7); //7 years

No runtime deps