[−][src]Struct watchface::time::Time
Simple representation of time
This is a simplified representation of time, so that it can also be used in applications without a full operating system or without chrono dependency.
Implementations
impl Time
[src]
pub fn from_unix_epoch(epoch: u64, timezone_offset: u64) -> Self
[src]
Return a time from a unix epoch and timezone offset
Arguments
epoch
- The number of seconds since 1970-01-01T00:00:00timezone_offset
- The number of seconds timezone offset
Examples
use watchface::time::Time; // GMT+02:00 let timezone_offset = 2 * 60 * 60; // 2020-09-03T19:23:02 let time = Time::from_unix_epoch(1599160982, timezone_offset); assert_eq!(time.hours_local(), 21); assert_eq!(time.minutes_local(), 23); assert_eq!(time.seconds_local(), 02);
pub fn hours_local(&self) -> u8
[src]
Get hours in local timezone
pub fn minutes_local(&self) -> u8
[src]
Get minutes in local timezone
pub fn seconds_local(&self) -> u8
[src]
Get seconds in local timezone
Trait Implementations
impl Debug for Time
[src]
impl Default for Time
[src]
impl Eq for Time
[src]
impl From<DateTime<Local>> for Time
[src]
Create a time from a chrono DateTime
impl PartialEq<Time> for Time
[src]
impl StructuralEq for Time
[src]
impl StructuralPartialEq for Time
[src]
Auto Trait Implementations
impl RefUnwindSafe for Time
impl Send for Time
impl Sync for Time
impl Unpin for Time
impl UnwindSafe for Time
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,