#[repr(C)]pub struct Timestamp {
pub year_from_1970: u8,
pub month: u8,
pub days: u8,
pub hours: u8,
pub minutes: u8,
pub seconds: u8,
}
Expand description
Describes an instant in time. The system only supports local time and has no concept of time zones.
Fields§
§year_from_1970: u8
The Gregorian calendar year, minus 1970 (so 10 is 1980, and 30 is the year 2000)
month: u8
The month of the year, where January is 1 and December is 12
days: u8
The day of the month where 1 is the first of the month, through to 28, 29, 30 or 31 (as appropriate)
hours: u8
The hour in the day, from 0 to 23
minutes: u8
The minutes past the hour, from 0 to 59
seconds: u8
The seconds past the minute, from 0 to 59. Note that some filesystems only have 2-second precision on their timestamps.
Implementations§
Source§impl Timestamp
impl Timestamp
Sourcepub fn day_of_week(&self) -> DayOfWeek
pub fn day_of_week(&self) -> DayOfWeek
Returns the day of the week for the given timestamp.
Sourcepub fn increment(&mut self, days: u32, seconds: u32)
pub fn increment(&mut self, days: u32, seconds: u32)
Move this timestamp forward by a number of days and seconds.
Sourcepub fn is_leap_year(&self) -> bool
pub fn is_leap_year(&self) -> bool
Returns true if this is a leap year, false otherwise.
Sourcepub fn days_in_month(&self) -> u8
pub fn days_in_month(&self) -> u8
Returns the number of days in the current month
Trait Implementations§
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§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more