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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
use glib_sys;
use translate::*;
use GString;
use TimeType;
glib_wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct TimeZone(Shared<glib_sys::GTimeZone>);
match fn {
ref => |ptr| glib_sys::g_time_zone_ref(ptr),
unref => |ptr| glib_sys::g_time_zone_unref(ptr),
get_type => || glib_sys::g_time_zone_get_type(),
}
}
impl TimeZone {
pub fn new(identifier: Option<&str>) -> TimeZone {
unsafe { from_glib_full(glib_sys::g_time_zone_new(identifier.to_glib_none().0)) }
}
pub fn new_local() -> TimeZone {
unsafe { from_glib_full(glib_sys::g_time_zone_new_local()) }
}
#[cfg(any(feature = "v2_58", feature = "dox"))]
pub fn new_offset(seconds: i32) -> TimeZone {
unsafe { from_glib_full(glib_sys::g_time_zone_new_offset(seconds)) }
}
pub fn new_utc() -> TimeZone {
unsafe { from_glib_full(glib_sys::g_time_zone_new_utc()) }
}
pub fn find_interval(&self, type_: TimeType, time_: i64) -> i32 {
unsafe {
glib_sys::g_time_zone_find_interval(self.to_glib_none().0, type_.to_glib(), time_)
}
}
pub fn get_abbreviation(&self, interval: i32) -> Option<GString> {
unsafe {
from_glib_none(glib_sys::g_time_zone_get_abbreviation(
self.to_glib_none().0,
interval,
))
}
}
#[cfg(any(feature = "v2_58", feature = "dox"))]
pub fn get_identifier(&self) -> Option<GString> {
unsafe { from_glib_none(glib_sys::g_time_zone_get_identifier(self.to_glib_none().0)) }
}
pub fn get_offset(&self, interval: i32) -> i32 {
unsafe { glib_sys::g_time_zone_get_offset(self.to_glib_none().0, interval) }
}
pub fn is_dst(&self, interval: i32) -> bool {
unsafe {
from_glib(glib_sys::g_time_zone_is_dst(
self.to_glib_none().0,
interval,
))
}
}
}
unsafe impl Send for TimeZone {}
unsafe impl Sync for TimeZone {}