dostime
This crate converts MS DOS times to and from various formats, including integers, byte arrays, and types in external crates (see the features for more information).
This crate is no_std compatible.
An explanation of the date and time formats can be found
here,
though the documentation for DOSTime and DOSDate also includes explantions for the format.
use ;
use DateError;
use TimeError;
use DateTimeError;
// Valid dates and times can be constructed.
let date = new.unwrap; // 2017-04-06
let time = new.unwrap; // 13:24:54
let datetime = new; // 2006-04-15 01:05:34
// Invalid dates and times can't be constructed and information about what is invalid is
// returned.
let invalid_month = new.unwrap_err;
assert_eq!;
let invalid_second = new.unwrap_err;
assert_eq!;
let invalid_day = new.unwrap_err;
assert_eq!;
// Dates and times can be converted to and from integers and arrays of bytes.
let int: u16 = date.into;
assert_eq!;
assert_eq!;
let bytes: = time.into;
assert_eq!;
assert_eq!;
Features
serde-1- enables (de)serialization with Serdetime-1- enables conversion to/from types in thetimecrate (Date,Time, andPrimitiveDateTime)chrono-1- enables conversion to/from types in thechronocrate (NaiveDate,NaiveTime, andNaiveDateTime)
Future Work
If anyone thinks of something else that this crate should have or spots any bugs, let me know! I'll see if I can add it. Alternatively, feel free to submit a pull request (or just fork it). I'll review and approve it as soon as I can.