Tz

Enum Tz 

Source
pub enum Tz {
Show 22 variants UtcWet = 0, BstCet = 3_600, CestEet = 7_200, EestAst = 10_800, Ist = 19_800, JstKst = 32_400, CstAwstSstHkt = 28_800, Acst = 34_200, AestChst = 36_000, Lwst = 37_800, NzstFjt = 43_200, Sast = -39_600, Hast = -36_000, Alst = -32_400, Pst = -28_800, Mst = -25_200, Censt = -21_600, Est = -18_000, AtstClt = -14_400, Nst = -12_600, BtAtArtUyt = -10_800, IctWib = 25_200,
}

Variants§

§

UtcWet = 0

Universal Standard Time (+00:00) and Western European Time (+00:00)

§

BstCet = 3_600

British Summer Time (+01:00) and Central European Time (+01:00)

§

CestEet = 7_200

Central European Summer Time (+02:00) and Eastern European Time (+02:00)

§

EestAst = 10_800

Eastern European Summer Time (+03:00) and Arabian Standard Time (+03:00)

§

Ist = 19_800

Indian Standard Time (+05:30)

§

JstKst = 32_400

Japan Standard Time (+09:00) and Korea Standard Time (+09:00)

§

CstAwstSstHkt = 28_800

China Standard Time (+08:00), Australian Western Standard Time (+08:00), Singapore Standard Time (+08:00) and Hong Kong Time (+08:00)

§

Acst = 34_200

Australian Central Standard Time (+09:30)

§

AestChst = 36_000

Australian Eastern Standard Time (+10:00), Chamorro Standard Time (+10:00)

§

Lwst = 37_800

Lord Howe Standard Time (+10:30)

§

NzstFjt = 43_200

New Zealand Standard Time (+12:00) and Fiji Time (+12:00)

§

Sast = -39_600

Samoa Standard Time (-11:00)

§

Hast = -36_000

Hawaii-Aleutian Standard Time (-10:00)

§

Alst = -32_400

Alaska Standard Time (-09:00)

§

Pst = -28_800

Pacific Standard Time (-08:00)

§

Mst = -25_200

Mountain Standard Time (-07:00)

§

Censt = -21_600

Central Standard Time (-06:00)

§

Est = -18_000

Eastern Standard Time (-05:00)

§

AtstClt = -14_400

Atlantic Standard Time (-04:00) and Chile Time (-04:00)

§

Nst = -12_600

Newfoundland Standard Time (-03:30)

§

BtAtArtUyt = -10_800

Brazil Time (-03:00), Fernando de Noronha Time (-02:00), Argentina Time (-03:00) and Uruguay Time (-03:00)

§

IctWib = 25_200

Indochina Time (+07:00) and Western Indonesian Time (+07:00)

Implementations§

Source§

impl Tz

Source

pub fn offset(&self) -> i32

Returns the offset in seconds from UTC.

§Examples
use thetime::Tz;
println!("{}", Tz::UtcWet.offset()); // 0
println!("{}", Tz::BstCet.offset()); // 3600
println!("{}", Tz::CestEet.offset()); // 7200
Source

pub fn offset_str(&self) -> String

Returns the offset in seconds from UTC as a string.

§Examples
use thetime::Tz;
println!("{}", Tz::UtcWet.offset_str()); // +00:00
println!("{}", Tz::BstCet.offset_str()); // +01:00
println!("{}", Tz::CestEet.offset_str()); // +02:00
Source

pub fn name(&self) -> String

Returns the name of the timezone.

§Examples
use thetime::Tz;
println!("{}", Tz::UtcWet.name()); // UTC/WET
println!("{}", Tz::BstCet.name()); // BST/CET
println!("{}", Tz::CestEet.name()); // CEST/EET
Source

pub fn from_name<T: ToString>(name: T) -> Option<Self>

Returns the timezone from the name.

§Examples
use thetime::Tz;
println!("{:?}", Tz::from_name("UTC/WET")); // Some(UtcWet)
println!("{:?}", Tz::from_name("BST/CET")); // Some(BstCet)
println!("{:?}", Tz::from_name("CEST/EET")); // Some(CestEet)
println!("{:?}", Tz::from_name("Life? Don't talk to me about life!")); // None
Source

pub fn from_offset(offset: i32) -> Option<Self>

Returns the timezone from the offset.

§Examples
use thetime::Tz;
println!("{:?}", Tz::from_offset(0)); // Some(UtcWet)
println!("{:?}", Tz::from_offset(3600)); // Some(BstCet)
println!("{:?}", Tz::from_offset(7200)); // Some(CestEet)
println!("{:?}", Tz::from_offset(123456)); // None
Source

pub fn from_offset_str(offset: &str) -> Option<Self>

Source

pub fn offset_struct<T: Time>(&self, time: T) -> T

Offsets the provided struct by the timezone.

§Examples
use thetime::{Time, System, Tz};
println!("{:?}", Tz::Acst.offset_struct(System::now()));

Trait Implementations§

Source§

impl Clone for Tz

Source§

fn clone(&self) -> Tz

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Tz

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Tz

Source§

fn default() -> Tz

Returns the “default value” for a type. Read more
Source§

impl Display for Tz

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Tz

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Tz

Source§

fn eq(&self, other: &Tz) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Tz

Source§

impl Eq for Tz

Source§

impl StructuralPartialEq for Tz

Auto Trait Implementations§

§

impl Freeze for Tz

§

impl RefUnwindSafe for Tz

§

impl Send for Tz

§

impl Sync for Tz

§

impl Unpin for Tz

§

impl UnwindSafe for Tz

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.