oysters_core 0.1.3

Core for the Oysters LRU k/v store
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use chrono::{TimeZone, Utc};

/// Get a [`usize`] timestamp from the given `year` epoch
pub fn epoch_timestamp(year: u16) -> usize {
    let now = Utc::now().timestamp_millis();
    let then = Utc
        .with_ymd_and_hms(year as i32, 1, 1, 0, 0, 0)
        .unwrap()
        .timestamp_millis();

    (now - then) as usize
}