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
use crate::time::chrono::Time;

impl Time {
    /// Returns a new Time object, one second later than time.
    ///
    /// This method should log a deprecation warning if [`Time::nanosecond`] is
    /// non-zero.
    ///
    /// # Examples
    ///
    /// ```
    /// # use spinoso_time::Time;
    /// let now = Time::now();
    /// let next = now.succ();
    /// assert_eq!(now.to_int() + 1, next.to_int());
    /// ```
    #[inline]
    #[must_use]
    pub fn succ(self) -> Self {
        let Self {
            timestamp,
            sub_second_nanos,
            offset,
        } = self;
        Self {
            timestamp: timestamp + 1,
            sub_second_nanos,
            offset,
        }
    }
}