2017-08-13 22:40:43 +00:00
|
|
|
// This file was generated by gir (cf27827) from gir-files (???)
|
2017-07-29 14:11:44 +00:00
|
|
|
// DO NOT EDIT
|
|
|
|
|
|
|
|
use ffi;
|
2017-08-02 08:39:37 +00:00
|
|
|
use glib;
|
2017-07-29 14:11:44 +00:00
|
|
|
use glib::translate::*;
|
|
|
|
use glib_ffi;
|
|
|
|
use gobject_ffi;
|
|
|
|
use std::mem;
|
|
|
|
use std::ptr;
|
|
|
|
|
|
|
|
glib_wrapper! {
|
|
|
|
pub struct DateTime(Shared<ffi::GstDateTime>);
|
|
|
|
|
|
|
|
match fn {
|
|
|
|
ref => |ptr| ffi::gst_date_time_ref(ptr),
|
|
|
|
unref => |ptr| ffi::gst_date_time_unref(ptr),
|
|
|
|
get_type => || ffi::gst_date_time_get_type(),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl DateTime {
|
|
|
|
pub fn new(tzoffset: f32, year: i32, month: i32, day: i32, hour: i32, minute: i32, seconds: f64) -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new(tzoffset, year, month, day, hour, minute, seconds))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-02 08:39:37 +00:00
|
|
|
pub fn new_from_g_date_time(dt: &glib::DateTime) -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new_from_g_date_time(dt.to_glib_full()))
|
|
|
|
}
|
|
|
|
}
|
2017-07-29 14:11:44 +00:00
|
|
|
|
|
|
|
pub fn new_from_iso8601_string(string: &str) -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new_from_iso8601_string(string.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn new_from_unix_epoch_local_time(secs: i64) -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new_from_unix_epoch_local_time(secs))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn new_from_unix_epoch_utc(secs: i64) -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new_from_unix_epoch_utc(secs))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn new_local_time(year: i32, month: i32, day: i32, hour: i32, minute: i32, seconds: f64) -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new_local_time(year, month, day, hour, minute, seconds))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn new_now_local_time() -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new_now_local_time())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn new_now_utc() -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new_now_utc())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn new_y(year: i32) -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new_y(year))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn new_ym(year: i32, month: i32) -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new_ym(year, month))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn new_ymd(year: i32, month: i32, day: i32) -> DateTime {
|
|
|
|
assert_initialized_main_thread!();
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_new_ymd(year, month, day))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_day(&self) -> i32 {
|
|
|
|
unsafe {
|
|
|
|
ffi::gst_date_time_get_day(self.to_glib_none().0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_hour(&self) -> i32 {
|
|
|
|
unsafe {
|
|
|
|
ffi::gst_date_time_get_hour(self.to_glib_none().0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_microsecond(&self) -> i32 {
|
|
|
|
unsafe {
|
|
|
|
ffi::gst_date_time_get_microsecond(self.to_glib_none().0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_minute(&self) -> i32 {
|
|
|
|
unsafe {
|
|
|
|
ffi::gst_date_time_get_minute(self.to_glib_none().0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_month(&self) -> i32 {
|
|
|
|
unsafe {
|
|
|
|
ffi::gst_date_time_get_month(self.to_glib_none().0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_second(&self) -> i32 {
|
|
|
|
unsafe {
|
|
|
|
ffi::gst_date_time_get_second(self.to_glib_none().0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_time_zone_offset(&self) -> f32 {
|
|
|
|
unsafe {
|
|
|
|
ffi::gst_date_time_get_time_zone_offset(self.to_glib_none().0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn get_year(&self) -> i32 {
|
|
|
|
unsafe {
|
|
|
|
ffi::gst_date_time_get_year(self.to_glib_none().0)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn has_day(&self) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_date_time_has_day(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn has_month(&self) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_date_time_has_month(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn has_second(&self) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_date_time_has_second(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn has_time(&self) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_date_time_has_time(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn has_year(&self) -> bool {
|
|
|
|
unsafe {
|
|
|
|
from_glib(ffi::gst_date_time_has_year(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-02 08:39:37 +00:00
|
|
|
pub fn to_g_date_time(&self) -> Option<glib::DateTime> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_to_g_date_time(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
2017-07-29 14:11:44 +00:00
|
|
|
|
|
|
|
pub fn to_iso8601_string(&self) -> Option<String> {
|
|
|
|
unsafe {
|
|
|
|
from_glib_full(ffi::gst_date_time_to_iso8601_string(self.to_glib_none().0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
unsafe impl Send for DateTime {}
|