fn duration_to_secs<T: TryFrom<u64>>(duration: Duration) -> Result<T>
Convert to seconds, rounding up if necessary.