Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down Expand Up @@ -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(), '+');
}
}