pub struct Timestamp {
pub year_since_1970: u8,
pub zero_indexed_month: u8,
pub zero_indexed_day: u8,
pub hours: u8,
pub minutes: u8,
pub seconds: u8,
}
Expand description
Represents an instant in time, in the local time zone. TODO: Consider
replacing this with POSIX time as a u32
, which would save two bytes at
the expense of some maths.
Fields§
§year_since_1970: u8
Add 1970 to this file to get the calendar year
zero_indexed_month: u8
Add one to this value to get the calendar month
zero_indexed_day: u8
Add one to this value to get the calendar day
hours: u8
The number of hours past midnight
minutes: u8
The number of minutes past the hour
seconds: u8
The number of seconds past the minute
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn from_fat(date: u16, time: u16) -> Timestamp
pub fn from_fat(date: u16, time: u16) -> Timestamp
Create a Timestamp
from the 16-bit FAT date and time fields.
Sourcepub fn serialize_to_fat(self) -> [u8; 4]
pub fn serialize_to_fat(self) -> [u8; 4]
Serialize a Timestamp
to FAT format
Sourcepub fn from_calendar(
year: u16,
month: u8,
day: u8,
hours: u8,
minutes: u8,
seconds: u8,
) -> Result<Timestamp, &'static str>
pub fn from_calendar( year: u16, month: u8, day: u8, hours: u8, minutes: u8, seconds: u8, ) -> Result<Timestamp, &'static str>
Create a Timestamp
from year/month/day/hour/minute/second.
Values should be given as you’d write then (i.e. 1980, 01, 01, 13, 30, 05) is 1980-Jan-01, 1:30:05pm.
Trait Implementations§
Source§impl Ord for Timestamp
impl Ord for Timestamp
Source§impl PartialOrd for Timestamp
impl PartialOrd for Timestamp
impl Copy for Timestamp
impl Eq for Timestamp
impl StructuralPartialEq for Timestamp
Auto Trait Implementations§
impl Freeze for Timestamp
impl RefUnwindSafe for Timestamp
impl Send for Timestamp
impl Sync for Timestamp
impl Unpin for Timestamp
impl UnwindSafe for Timestamp
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)Source§impl<Q, K> Comparable<K> for Qwhere
Q: Ord + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Comparable<K> for Qwhere
Q: Ord + ?Sized,
K: Borrow<Q> + ?Sized,
Source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.