]> git.proxmox.com Git - cargo.git/blobdiff - vendor/git2/src/time.rs
New upstream version 0.52.0
[cargo.git] / vendor / git2 / src / time.rs
index 92dc0b36ff31d9d272499354b346b9c33b9e8480..a01de7abb08fa0a51e3b912c86713a4a728a518a 100644 (file)
@@ -42,7 +42,7 @@ impl Time {
     /// Return whether the offset was positive or negative. Primarily useful
     /// in case the offset is specified as a negative zero.
     pub fn sign(&self) -> char {
-        self.raw.offset as u8 as char
+        self.raw.sign as u8 as char
     }
 }
 
@@ -112,3 +112,16 @@ impl Ord for IndexTime {
         me.cmp(&other)
     }
 }
+
+#[cfg(test)]
+mod tests {
+    use crate::Time;
+
+    #[test]
+    fn smoke() {
+        assert_eq!(Time::new(1608839587, -300).seconds(), 1608839587);
+        assert_eq!(Time::new(1608839587, -300).offset_minutes(), -300);
+        assert_eq!(Time::new(1608839587, -300).sign(), '-');
+        assert_eq!(Time::new(1608839587, 300).sign(), '+');
+    }
+}