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
// Take a look at the license at the top of the repository in the LICENSE file.

use crate::translate::*;
use crate::{TimeType, TimeZone};

impl TimeZone {
    /// Finds an interval within @self that corresponds to the given @time_,
    /// possibly adjusting @time_ if required to fit into an interval.
    /// The meaning of @time_ depends on @type_.
    ///
    /// This function is similar to g_time_zone_find_interval(), with the
    /// difference that it always succeeds (by making the adjustments
    /// described below).
    ///
    /// In any of the cases where g_time_zone_find_interval() succeeds then
    /// this function returns the same value, without modifying @time_.
    ///
    /// This function may, however, modify @time_ in order to deal with
    /// non-existent times.  If the non-existent local @time_ of 02:30 were
    /// requested on March 14th 2010 in Toronto then this function would
    /// adjust @time_ to be 03:00 and return the interval containing the
    /// adjusted time.
    /// ## `type_`
    /// the #GTimeType of @time_
    /// ## `time_`
    /// a pointer to a number of seconds since January 1, 1970
    ///
    /// # Returns
    ///
    /// the interval containing @time_, never -1
    #[doc(alias = "g_time_zone_adjust_time")]
    pub fn adjust_time(&self, type_: TimeType, mut time: i64) -> (i32, i64) {
        unsafe {
            let res =
                ffi::g_time_zone_adjust_time(self.to_glib_none().0, type_.into_glib(), &mut time);
            (res, time)
        }
    }
}