2020-03-02 01:53:41 -05:00
|
|
|
// This file is part of Moonfire NVR, a security camera network video recorder.
|
2021-02-17 16:28:48 -05:00
|
|
|
// Copyright (C) 2020 The Moonfire NVR Authors; see AUTHORS and LICENSE.txt.
|
|
|
|
// SPDX-License-Identifier: GPL-v3.0-or-later WITH GPL-3.0-linking-exception.
|
2017-01-16 15:50:47 -05:00
|
|
|
|
2018-02-21 01:46:14 -05:00
|
|
|
use failure::Error;
|
2020-04-18 01:41:55 -04:00
|
|
|
use structopt::StructOpt;
|
2017-01-16 15:50:47 -05:00
|
|
|
|
2020-04-18 01:41:55 -04:00
|
|
|
#[derive(StructOpt)]
|
|
|
|
pub struct Args {
|
|
|
|
/// Timestamp(s) to translate.
|
|
|
|
///
|
|
|
|
/// May be either an integer or an RFC-3339-like string:
|
2021-04-10 20:34:52 -04:00
|
|
|
/// `YYYY-mm-dd[THH:MM[:SS[:FFFFF]]][{Z,{+,-,}HH:MM}]`.
|
2020-04-18 01:41:55 -04:00
|
|
|
///
|
2021-04-10 20:34:52 -04:00
|
|
|
/// Eg: `142913484000000`, `2020-04-26`, `2020-04-26T12:00:00:00000-07:00`.
|
2020-04-18 01:41:55 -04:00
|
|
|
#[structopt(required = true)]
|
|
|
|
timestamps: Vec<String>,
|
2017-01-16 15:50:47 -05:00
|
|
|
}
|
|
|
|
|
2021-02-11 13:45:56 -05:00
|
|
|
pub fn run(args: &Args) -> Result<i32, Error> {
|
2020-04-18 01:41:55 -04:00
|
|
|
for timestamp in &args.timestamps {
|
2018-12-28 22:53:29 -05:00
|
|
|
let t = db::recording::Time::parse(timestamp)?;
|
2017-01-16 15:50:47 -05:00
|
|
|
println!("{} == {}", t, t.0);
|
|
|
|
}
|
2021-02-11 13:45:56 -05:00
|
|
|
Ok(0)
|
2017-01-16 15:50:47 -05:00
|
|
|
}
|