Input: Fix Duration underflow on negative start time (#83)

This commit is contained in:
Jude Southworth
2021-06-24 16:57:40 +00:00
committed by GitHub
parent af79c23b19
commit e58cadb2a4

View File

@@ -47,7 +47,7 @@ impl Metadata {
let start_time = format
.and_then(|m| m.get("start_time"))
.and_then(Value::as_str)
.and_then(|v| v.parse::<f64>().ok())
.and_then(|v| v.parse::<f64>().ok().map(|t| t.max(0.0)))
.map(Duration::from_secs_f64);
let tags = format.and_then(|m| m.get("tags"));