Crate veeks_millis[−][src]
veeks_millis
2021 new date time units and formats: veeks and millis
repo; version: 0.5.5 date: 2021-02-02 authors: Luciano Bestia
Proposal for a new date and time units and formats
Veeks and millis are my suggestion for new date-time units and formats.
Here is a long read about the date-time reform proposal:
https://github.com/LucianoBestia/new_date_time_units_and_formats/
A super short explanation:
Months are obsolete and they are not used in the new format.
Years remain the same.
Veek is similar to week. One year has 52 full veeks with 7 days.
The exception is the last 53rd veek that has only 1 celebration day. For leap years there are 2 celebration days.
The new year always starts with 01v 1d
- short pronunciation one-vee one-dee. Basically every year starts with a monday.
Veek-days are similar to week-days, but without names. They use just numbers and the d
unit.
1d
is the new name for Monday and 7d
is the new name for Sunday.
The veek-date format is global for every language and looks exactly like this: 2021c 52v 2d
The year must have 4 digits from 1000c to 9999c. The unit c
stands for CE - common era. Space.
The veek must have 2 digits from 01v to 53v. The unit v
stands for veek. Space.
The day must have 1 digit from 1d to 7d. The unit d
stands for day. End.
Hours, minutes and seconds are obsolete.
One day is divided into 1000md.
Millis is the short name for milliday. The unit is md
.
For shorter time intervals there is microdays or micros, unit μd
. 1md
has 1000μd
.
This crate contains functions to use with the new units veeks and millis.
It is dependent on the crate chrono
for NaiveDate
and NaiveTime
.
Used in projects
https://github.com/LucianoBestia/new_date_time_units_and_formats/
cargo crev reviews and advisory
It is recommended to always use cargo-crev
to verify the trustworthiness of each of your dependencies.
Please, spread this info.
On the web use this url to read crate reviews. Example:
https://web.crev.dev/rust-reviews/crate/num-traits/
Functions
micros_from_str_opt | convert string micros to f64 micros (microdays) returns None if unrecognized format |
micros_to_seconds | convert micros (microdays) f64 to seconds f64 |
millis_from_str_opt | convert string millis into f64 millis returns None if unrecognized format |
millis_to_naive_time_opt | convert f64 millis to chrono NaiveTime returns None if error |
naive_date_to_veek_date | convert chrono NaiveDate into String with veek-date format veek-date format in short: 4 digit year has the unit c for CE common era, one space 2 digit for veek (very similar to week) from 01v to 53v, has unit v, one space 1 digit for veek-day from 1d (monday) to 7d(sunday) |
naive_time_to_millis | convert chrono NaiveTime into float millis be careful that floats must be rounded before presenting it to humans |
naive_time_to_millis_str | convert chrono NaiveTime into String with millis format rounded to 1 milliday |
seconds_to_micros | convert seconds to micros (microdays) |
veek_to_naive_date_opt | convert String with veek format to chrono NaiveDate return None if the string is not in a correct veek-format veek format in short: 4 digit year has the unit c for CE common era, one space 2 digit for veek (very similar to week) from 01v to 53v, has unit v, one space 1 digit for veek-day from 1d (monday) to 7d(sunday) |