pub struct Time {
pub seconds_since_unix_epoch: u32,
pub offset_in_seconds: i32,
pub sign: Sign,
}
Expand description
A timestamp with timezone.
Fields§
§seconds_since_unix_epoch: u32
time in seconds since epoch.
offset_in_seconds: i32
time offset in seconds, may be negative to match the sign
field.
sign: Sign
the sign of offset
, used to encode -0000
which would otherwise loose sign information.
Implementations§
Source§impl Time
Instantiation
impl Time
Instantiation
Sourcepub fn new(seconds_since_unix_epoch: u32, offset_in_seconds: i32) -> Self
pub fn new(seconds_since_unix_epoch: u32, offset_in_seconds: i32) -> Self
Create a new instance from seconds and offset.
Sourcepub fn now_local() -> Option<Self>
pub fn now_local() -> Option<Self>
Return the current local time, or None
if the local time wasn’t available.
Sourcepub fn now_local_or_utc() -> Self
pub fn now_local_or_utc() -> Self
Return the current local time, or the one at UTC if the local time wasn’t available.
Source§impl Time
Serialization with standard git
format
impl Time
Serialization with standard git
format
Sourcepub fn to_bstring(&self) -> BString
pub fn to_bstring(&self) -> BString
Serialize this instance into memory, similar to what write_to()
would do with arbitrary Write
implementations.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Time
impl<'de> Deserialize<'de> for Time
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Time
impl Ord for Time
Source§impl PartialOrd for Time
impl PartialOrd for Time
impl Copy for Time
impl Eq for Time
impl StructuralPartialEq for Time
Auto Trait Implementations§
impl Freeze for Time
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
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