Return the current Unix timestamp in milliseconds, saturating to [`i64::MAX`] on overflow. Returns `0` if the system clock is before the Unix epoch. Prefer this over local implementations of the same pattern.
()
| 10 | /// |
| 11 | /// Prefer this over local implementations of the same pattern. |
| 12 | pub fn now_ms() -> i64 { |
| 13 | SystemTime::now() |
| 14 | .duration_since(UNIX_EPOCH) |
| 15 | .map_or(0, |d| i64::try_from(d.as_millis()).unwrap_or(i64::MAX)) |
| 16 | } |
no outgoing calls