[][src]Struct gstreamer::DateTime

pub struct 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]

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]

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]

pub fn to_utc(&self) -> Result<DateTime, BoolError>[src]

Trait Implementations

impl Clone for DateTime[src]

impl Debug for DateTime[src]

impl<'de> Deserialize<'de> for DateTime[src]

impl Display for DateTime[src]

impl PartialEq<DateTime> for DateTime[src]

impl PartialOrd<DateTime> for DateTime[src]

impl Send for DateTime[src]

impl<'a> Serialize for DateTime[src]

impl StaticType for DateTime[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.

impl<'a> TryFrom<&'a DateTime> for DateTime[src]

type Error = BoolError

The type returned in the event of a conversion error.

impl TryFrom<DateTime> for DateTime[src]

type Error = BoolError

The type returned in the event of a conversion error.

impl TryFrom<DateTime> for DateTime[src]

type Error = BoolError

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for DateTime

impl Unpin for DateTime

impl UnwindSafe for DateTime

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *const GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GList> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<'a, T> ToGlibContainerFromSlice<'a, *mut GPtrArray> for T where
    T: GlibPtrDefault + ToGlibPtr<'a, <T as GlibPtrDefault>::GlibType>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToSendValue for T where
    T: ToValue + SetValue + Send + ?Sized
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToValue for T where
    T: SetValue + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.