Struct glib::TimeZone[][src]

pub struct TimeZone(_);
Expand description

TimeZone is an opaque structure whose members cannot be accessed directly.

Implementations

A version of g_time_zone_new_identifier() which returns the UTC time zone if identifier could not be parsed or loaded.

If you need to check whether identifier was loaded successfully, use g_time_zone_new_identifier().

Deprecated since 2.68

Use g_time_zone_new_identifier() instead, as it provides error reporting. Change your code to handle a potentially None return value.

identifier

a timezone identifier

Returns

the requested timezone

Creates a TimeZone corresponding to local time. The local time zone may change between invocations to this function; for example, if the system administrator changes it.

This is equivalent to calling new() with the value of the TZ environment variable (including the possibility of None).

You should release the return value by calling g_time_zone_unref() when you are done with it.

Returns

the local timezone

This is supported on crate feature v2_58 only.

Creates a TimeZone corresponding to the given constant offset from UTC, in seconds.

This is equivalent to calling new() with a string in the form [+|-]hh[:mm[:ss]].

seconds

offset to UTC, in seconds

Returns

a timezone at the given offset from UTC

Creates a TimeZone corresponding to UTC.

This is equivalent to calling new() with a value like “Z”, “UTC”, “+00”, etc.

You should release the return value by calling g_time_zone_unref() when you are done with it.

Returns

the universal timezone

Finds an interval within self that corresponds to the given time_. The meaning of time_ depends on type_.

If type_ is TimeType::Universal then this function will always succeed (since universal time is monotonic and continuous).

Otherwise time_ is treated as local time. The distinction between TimeType::Standard and TimeType::Daylight is ignored except in the case that the given time_ is ambiguous. In Toronto, for example, 01:30 on November 7th 2010 occurred twice (once inside of daylight savings time and the next, an hour later, outside of daylight savings time). In this case, the different value of type_ would result in a different interval being returned.

It is still possible for this function to fail. In Toronto, for example, 02:00 on March 14th 2010 does not exist (due to the leap forward to begin daylight savings time). -1 is returned in that case.

type_

the TimeType of time_

time_

a number of seconds since January 1, 1970

Returns

the interval containing time_, or -1 in case of failure

Determines the time zone abbreviation to be used during a particular interval of time in the time zone self.

For example, in Toronto this is currently “EST” during the winter months and “EDT” during the summer months when daylight savings time is in effect.

interval

an interval within the timezone

Returns

the time zone abbreviation, which belongs to self

This is supported on crate feature v2_58 only.

Get the identifier of this TimeZone, as passed to new(). If the identifier passed at construction time was not recognised, UTC will be returned. If it was None, the identifier of the local timezone at construction time will be returned.

The identifier will be returned in the same format as provided at construction time: if provided as a time offset, that will be returned by this function.

Returns

identifier for this timezone

Determines the offset to UTC in effect during a particular interval of time in the time zone self.

The offset is the number of seconds that you add to UTC time to arrive at local time for self (ie: negative numbers for time zones west of GMT, positive numbers for east).

interval

an interval within the timezone

Returns

the number of seconds that should be added to UTC to get the local time in self

Determines if daylight savings time is in effect during a particular interval of time in the time zone self.

interval

an interval within the timezone

Returns

true if daylight savings time is in effect

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

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

This method returns an Ordering between self and other. Read more

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

Restrict a value to a certain interval. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Returns the type identifier of Self.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

Returns a SendValue clone of self.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.