Parse an interval string to microseconds. Delegates to `nodedb_types::kv_parsing::parse_interval_to_ms` (ms → μs) and `NdbDuration::parse` for compound shorthand forms.
(s: &str)
| 45 | /// Delegates to `nodedb_types::kv_parsing::parse_interval_to_ms` (ms → μs) |
| 46 | /// and `NdbDuration::parse` for compound shorthand forms. |
| 47 | pub(super) fn parse_interval_to_micros(s: &str) -> Option<i64> { |
| 48 | let s = s.trim(); |
| 49 | if s.is_empty() { |
| 50 | return None; |
| 51 | } |
| 52 | |
| 53 | // Try NdbDuration::parse first (handles compound "1h30m", "500ms", "2d"). |
| 54 | if let Some(dur) = nodedb_types::NdbDuration::parse(s) { |
| 55 | return Some(dur.micros); |
| 56 | } |
| 57 | |
| 58 | // Delegate to shared interval parser (handles all forms including compound). |
| 59 | if let Ok(ms) = nodedb_types::kv_parsing::parse_interval_to_ms(s) { |
| 60 | return Some(ms as i64 * 1000); // ms → μs |
| 61 | } |
| 62 | |
| 63 | None |
| 64 | } |
no test coverage detected