decrypt_cookies/firefox/items/
mod.rs1use chrono::{offset::LocalResult, DateTime, TimeZone, Utc};
2
3pub mod cookie;
5
6pub(super) trait I64ToMozTime {
8 fn micros_to_moz_utc(self) -> Option<DateTime<Utc>>;
9 fn secs_to_moz_utc(self) -> Option<DateTime<Utc>>;
10}
11
12impl I64ToMozTime for i64 {
13 fn micros_to_moz_utc(self) -> Option<DateTime<Utc>> {
14 match Utc.timestamp_micros(self) {
15 LocalResult::Single(time) => Some(time),
16 LocalResult::Ambiguous(..) | LocalResult::None => None,
17 }
18 }
19 fn secs_to_moz_utc(self) -> Option<DateTime<Utc>> {
20 match Utc.timestamp_opt(self, 0) {
21 LocalResult::Single(time) => Some(time),
22 LocalResult::Ambiguous(..) | LocalResult::None => None,
23 }
24 }
25}