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: i32
Implementations§
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 PartialOrd for HgTime
impl PartialOrd for HgTime
impl Copy for HgTime
impl StructuralPartialEq for HgTime
Auto Trait Implementations§
impl Freeze for HgTime
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