[−][src]Struct gstreamer::DateTime
Struct to store date, time and timezone information altogether.
DateTime
is refcounted and immutable.
Date information is handled using the proleptic Gregorian calendar.
Provides basic creation functions and accessor functions to its fields.
Implementations
impl DateTime
[src]
pub fn new(
tzoffset: f32,
year: i32,
month: i32,
day: i32,
hour: i32,
minute: i32,
seconds: f64
) -> Result<DateTime, BoolError>
[src]
tzoffset: f32,
year: i32,
month: i32,
day: i32,
hour: i32,
minute: i32,
seconds: f64
) -> Result<DateTime, BoolError>
Creates a new DateTime
using the date and times in the gregorian calendar
in the supplied timezone.
year
should be from 1 to 9999, month
should be from 1 to 12, day
from
1 to 31, hour
from 0 to 23, minutes
and seconds
from 0 to 59.
Note that tzoffset
is a float and was chosen so for being able to handle
some fractional timezones, while it still keeps the readability of
representing it in hours for most timezones.
If value is -1 then all over value will be ignored. For example
if month
== -1, then DateTime
will created only for year
. If
day
== -1, then DateTime
will created for year
and month
and
so on.
Free-function: gst_date_time_unref
tzoffset
Offset from UTC in hours.
year
the gregorian year
month
the gregorian month
day
the day of the gregorian month
hour
the hour of the day
minute
the minute of the hour
seconds
the second of the minute
Returns
the newly created DateTime
pub fn from_g_date_time(dt: &DateTime) -> Result<DateTime, BoolError>
[src]
pub fn from_iso8601_string(string: &str) -> Result<DateTime, BoolError>
[src]
pub fn from_unix_epoch_local_time(secs: i64) -> DateTime
[src]
pub fn from_unix_epoch_local_time_usecs(usecs: i64) -> DateTime
[src]
pub fn from_unix_epoch_utc(secs: i64) -> DateTime
[src]
pub fn from_unix_epoch_utc_usecs(usecs: i64) -> DateTime
[src]
pub fn new_local_time(
year: i32,
month: i32,
day: i32,
hour: i32,
minute: i32,
seconds: f64
) -> DateTime
[src]
year: i32,
month: i32,
day: i32,
hour: i32,
minute: i32,
seconds: f64
) -> DateTime
Creates a new DateTime
using the date and times in the gregorian calendar
in the local timezone.
year
should be from 1 to 9999, month
should be from 1 to 12, day
from
1 to 31, hour
from 0 to 23, minutes
and seconds
from 0 to 59.
If month
is -1, then the DateTime
created will only contain year
,
and all other fields will be considered not set.
If day
is -1, then the DateTime
created will only contain year
and
month
and all other fields will be considered not set.
If hour
is -1, then the DateTime
created will only contain year
and
month
and day
, and the time fields will be considered not set. In this
case minute
and seconds
should also be -1.
Free-function: gst_date_time_unref
year
the gregorian year
month
the gregorian month, or -1
day
the day of the gregorian month, or -1
hour
the hour of the day, or -1
minute
the minute of the hour, or -1
seconds
the second of the minute, or -1
Returns
the newly created DateTime
pub fn new_now_local_time() -> DateTime
[src]
Creates a new DateTime
representing the current date and time.
Free-function: gst_date_time_unref
Returns
the newly created DateTime
which should
be freed with DateTime::unref
.
pub fn new_now_utc() -> DateTime
[src]
Creates a new DateTime
that represents the current instant at Universal
coordinated time.
Free-function: gst_date_time_unref
Returns
the newly created DateTime
which should
be freed with DateTime::unref
.
pub fn new_y(year: i32) -> Result<DateTime, BoolError>
[src]
Creates a new DateTime
using the date and times in the gregorian calendar
in the local timezone.
year
should be from 1 to 9999.
Free-function: gst_date_time_unref
year
the gregorian year
Returns
the newly created DateTime
pub fn new_ym(year: i32, month: i32) -> Result<DateTime, BoolError>
[src]
Creates a new DateTime
using the date and times in the gregorian calendar
in the local timezone.
year
should be from 1 to 9999, month
should be from 1 to 12.
If value is -1 then all over value will be ignored. For example
if month
== -1, then DateTime
will created only for year
.
Free-function: gst_date_time_unref
year
the gregorian year
month
the gregorian month
Returns
the newly created DateTime
pub fn new_ymd(year: i32, month: i32, day: i32) -> Result<DateTime, BoolError>
[src]
Creates a new DateTime
using the date and times in the gregorian calendar
in the local timezone.
year
should be from 1 to 9999, month
should be from 1 to 12, day
from
1 to 31.
If value is -1 then all over value will be ignored. For example
if month
== -1, then DateTime
will created only for year
. If
day
== -1, then DateTime
will created for year
and month
and
so on.
Free-function: gst_date_time_unref
year
the gregorian year
month
the gregorian month
day
the day of the gregorian month
Returns
the newly created DateTime
pub fn get_day(&self) -> i32
[src]
Returns the day of the month of this DateTime
.
Call DateTime::has_day
before, to avoid warnings.
Returns
The day of this DateTime
pub fn get_hour(&self) -> i32
[src]
Retrieves the hour of the day represented by self
in the gregorian
calendar. The return is in the range of 0 to 23.
Call DateTime::has_time
before, to avoid warnings.
Returns
the hour of the day
pub fn get_microsecond(&self) -> i32
[src]
Retrieves the fractional part of the seconds in microseconds represented by
self
in the gregorian calendar.
Returns
the microsecond of the second
pub fn get_minute(&self) -> i32
[src]
Retrieves the minute of the hour represented by self
in the gregorian
calendar.
Call DateTime::has_time
before, to avoid warnings.
Returns
the minute of the hour
pub fn get_month(&self) -> i32
[src]
Returns the month of this DateTime
. January is 1, February is 2, etc..
Call DateTime::has_month
before, to avoid warnings.
Returns
The month of this DateTime
pub fn get_second(&self) -> i32
[src]
Retrieves the second of the minute represented by self
in the gregorian
calendar.
Call DateTime::has_time
before, to avoid warnings.
Returns
the second represented by self
pub fn get_time_zone_offset(&self) -> f32
[src]
Retrieves the offset from UTC in hours that the timezone specified
by self
represents. Timezones ahead (to the east) of UTC have positive
values, timezones before (to the west) of UTC have negative values.
If self
represents UTC time, then the offset is zero.
Returns
the offset from UTC in hours
pub fn get_year(&self) -> i32
[src]
Returns the year of this DateTime
Call DateTime::has_year
before, to avoid warnings.
Returns
The year of this DateTime
pub fn has_day(&self) -> bool
[src]
Returns
true
if self
's day field is set, otherwise false
pub fn has_month(&self) -> bool
[src]
Returns
true
if self
's month field is set, otherwise false
pub fn has_second(&self) -> bool
[src]
Returns
true
if self
's second field is set, otherwise false
pub fn has_time(&self) -> bool
[src]
Returns
true
if self
's hour and minute fields are set,
otherwise false
pub fn has_year(&self) -> bool
[src]
Returns
true
if self
's year field is set (which should always
be the case), otherwise false
pub fn to_g_date_time(&self) -> Result<DateTime, BoolError>
[src]
Creates a new glib::DateTime
from a fully defined DateTime
object.
Free-function: g_date_time_unref
Returns
a newly created glib::DateTime
, or
None
on error
pub fn to_iso8601_string(&self) -> Result<GString, BoolError>
[src]
Create a minimal string compatible with ISO-8601. Possible output formats are (for example): 2012, 2012-06, 2012-06-23, 2012-06-23T23:30Z, 2012-06-23T23:30+0100, 2012-06-23T23:30:59Z, 2012-06-23T23:30:59+0100
Returns
a newly allocated string formatted according
to ISO 8601 and only including the datetime fields that are
valid, or None
in case there was an error. The string should
be freed with g_free
.
impl DateTime
[src]
Trait Implementations
impl Clone for DateTime
[src]
impl Debug for DateTime
[src]
impl<'de> Deserialize<'de> for DateTime
[src]
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
[src]
impl Display for DateTime
[src]
impl PartialEq<DateTime> for DateTime
[src]
impl PartialOrd<DateTime> for DateTime
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Send for DateTime
[src]
impl<'a> Serialize for DateTime
[src]
impl StaticType for DateTime
[src]
fn static_type() -> Type
[src]
impl Sync for DateTime
[src]
impl<'a> TryFrom<&'a DateTime> for DateTime
[src]
type Error = BoolError
The type returned in the event of a conversion error.
fn try_from(v: &'a DateTime) -> Result<DateTime, BoolError>
[src]
impl<'a> TryFrom<&'a DateTime> for DateTime
[src]
type Error = BoolError
The type returned in the event of a conversion error.
fn try_from(v: &'a DateTime) -> Result<DateTime, BoolError>
[src]
impl TryFrom<DateTime> for DateTime
[src]
type Error = BoolError
The type returned in the event of a conversion error.
fn try_from(v: DateTime) -> Result<DateTime, BoolError>
[src]
impl TryFrom<DateTime> for DateTime
[src]
Auto Trait Implementations
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
[src]
t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
fn to_glib_container_from_slice(
_t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
[src]
_t: &'a [T]
) -> (*const GList, <T as ToGlibContainerFromSlice<'a, *const GList>>::Storage)
fn to_glib_full_from_slice(_t: &[T]) -> *const GList
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
[src]
t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
fn to_glib_container_from_slice(
_t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
[src]
_t: &'a [T]
) -> (*const GPtrArray, <T as ToGlibContainerFromSlice<'a, *const GPtrArray>>::Storage)
fn to_glib_full_from_slice(_t: &[T]) -> *const GPtrArray
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<Array>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GArray, <T as ToGlibContainerFromSlice<'a, *mut GArray>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GArray
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<List>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
[src]
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
[src]
t: &'a [T]
) -> (*mut GList, <T as ToGlibContainerFromSlice<'a, *mut GList>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GList
[src]
impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
[src]
T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>,
type Storage = (Option<PtrArray>, Vec<Stash<'a, <T as GlibPtrDefault>::GlibType, T>>)
fn to_glib_none_from_slice(
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
fn to_glib_container_from_slice(
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
[src]
t: &'a [T]
) -> (*mut GPtrArray, <T as ToGlibContainerFromSlice<'a, *mut GPtrArray>>::Storage)
fn to_glib_full_from_slice(t: &[T]) -> *mut GPtrArray
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToSendValue for T where
T: ToValue + SetValue + Send + ?Sized,
[src]
T: ToValue + SetValue + Send + ?Sized,
fn to_send_value(&self) -> SendValue
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> ToValue for T where
T: SetValue + ?Sized,
[src]
T: SetValue + ?Sized,
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>,