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) -> Time
pub fn new(seconds_since_unix_epoch: u32, offset_in_seconds: i32) -> Time
Create a new instance from seconds and offset.
Sourcepub fn now_local() -> Option<Time>
pub fn now_local() -> Option<Time>
Return the current local time, or None
if the local time wasn’t available.
Sourcepub fn now_local_or_utc() -> Time
pub fn now_local_or_utc() -> Time
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<Time, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Time, <__D as Deserializer<'de>>::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
Source§impl Serialize for Time
impl Serialize for Time
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
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