Struct below_common::dateutil::HgTime
source · pub struct HgTime {
pub unixtime: u64,
pub offset: i32,
}Expand description
A simple time structure that matches hg’s time representation.
Internally it’s unixtime (in GMT), and offset (GMT -1 = +3600).
Fields§
§unixtime: u64§offset: i32Implementations§
source§impl HgTime
impl HgTime
pub fn now() -> Self
sourcepub fn parse(date: &str) -> Option<Self>
pub fn parse(date: &str) -> Option<Self>
Parse a date string.
Return None if it cannot be parsed.
This function matches mercurial.util.parsedate, and can parse
some additional forms like 2 days ago.
It can also handle future forms like “ten hours from now” and “+10h”
sourcepub fn parse_range(date: &str) -> Option<Range<Self>>
pub fn parse_range(date: &str) -> Option<Range<Self>>
Parse a date string as a range.
For example, Apr 2000 covers range Apr 1, 2000 to Apr 30, 2000.
Also support more explicit ranges:
- START to END
-
START
- < END
pub fn parse_time_of_day(date: &str) -> Option<NaiveTime>
pub fn time_of_day_relative_to_system_time( system_time: SystemTime, time_of_day: NaiveTime ) -> Option<SystemTime>
pub fn min_value() -> Self
pub fn max_value() -> Self
Trait Implementations§
source§impl From<NaiveDateTime> for HgTime
impl From<NaiveDateTime> for HgTime
source§fn from(time: NaiveDateTime) -> Self
fn from(time: NaiveDateTime) -> Self
Converts to this type from the input type.
source§impl PartialEq<HgTime> for HgTime
impl PartialEq<HgTime> for HgTime
source§impl PartialOrd<HgTime> for HgTime
impl PartialOrd<HgTime> for HgTime
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl Copy for HgTime
impl StructuralPartialEq for HgTime
Auto Trait Implementations§
impl RefUnwindSafe for HgTime
impl Send for HgTime
impl Sync for HgTime
impl Unpin for HgTime
impl UnwindSafe for HgTime
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