1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use glib_sys;
use std::mem;
use translate::{StashMut, ToGlibPtrMut, Uninitialized};
pub use glib_sys::GTimeVal as TimeVal;
pub fn get_current_time() -> TimeVal {
unsafe {
let mut ret = mem::MaybeUninit::uninit();
glib_sys::g_get_current_time(ret.as_mut_ptr());
ret.assume_init()
}
}
#[doc(hidden)]
impl<'a> ToGlibPtrMut<'a, *mut glib_sys::GTimeVal> for TimeVal {
type Storage = &'a mut Self;
fn to_glib_none_mut(&'a mut self) -> StashMut<'a, *mut glib_sys::GTimeVal, Self> {
StashMut(self as *mut _, self)
}
}
impl Uninitialized for TimeVal {
unsafe fn uninitialized() -> TimeVal {
mem::zeroed()
}
}