sk-core 2.6.0

SimKube core libraries
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use clockabilly::{
    DateTime,
    Local,
};
use parse_datetime::{
    parse_datetime,
    parse_datetime_at_date,
};

pub fn duration_to_ts(tstr: &str) -> anyhow::Result<i64> {
    Ok(parse_datetime(tstr)?.timestamp())
}

pub fn duration_to_ts_from(start_ts: i64, tstr: &str) -> anyhow::Result<i64> {
    let local_time = DateTime::from_timestamp(start_ts, 0).unwrap().with_timezone(&Local);
    Ok(parse_datetime_at_date(local_time, tstr)?.timestamp())
}