Struct sf_api::gamestate::ServerTime
source · pub struct ServerTime(/* private fields */);
Expand description
Stores the time difference between the server and the client to parse the response timestamps and to always be able to know the servers (timezoned) time without sending new requests to ask it
Implementations§
source§impl ServerTime
impl ServerTime
sourcepub fn convert_to_local(
&self,
timestamp: i64,
name: &str
) -> Option<DateTime<Local>>
pub fn convert_to_local( &self, timestamp: i64, name: &str ) -> Option<DateTime<Local>>
Converts the raw timestamp from the server to the local time.
sourcepub fn current(&self) -> NaiveDateTime
pub fn current(&self) -> NaiveDateTime
The current time of the server in their time zone (whatever that might be). This uses the system time and calculates the offset to the servers time, so this is NOT the time at the last request, but the actual current time of the server.
Trait Implementations§
source§impl Clone for ServerTime
impl Clone for ServerTime
source§fn clone(&self) -> ServerTime
fn clone(&self) -> ServerTime
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ServerTime
impl Debug for ServerTime
source§impl Default for ServerTime
impl Default for ServerTime
source§fn default() -> ServerTime
fn default() -> ServerTime
Returns the “default value” for a type. Read more
source§impl<'de> Deserialize<'de> for ServerTime
impl<'de> Deserialize<'de> for ServerTime
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 ServerTime
impl Ord for ServerTime
source§fn cmp(&self, other: &ServerTime) -> Ordering
fn cmp(&self, other: &ServerTime) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for ServerTime
impl PartialEq for ServerTime
source§fn eq(&self, other: &ServerTime) -> bool
fn eq(&self, other: &ServerTime) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for ServerTime
impl PartialOrd for ServerTime
source§fn partial_cmp(&self, other: &ServerTime) -> Option<Ordering>
fn partial_cmp(&self, other: &ServerTime) -> Option<Ordering>
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 moresource§impl Serialize for ServerTime
impl Serialize for ServerTime
impl Copy for ServerTime
impl Eq for ServerTime
impl StructuralEq for ServerTime
impl StructuralPartialEq for ServerTime
Auto Trait Implementations§
impl RefUnwindSafe for ServerTime
impl Send for ServerTime
impl Sync for ServerTime
impl Unpin for ServerTime
impl UnwindSafe for ServerTime
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.