MCPcopy Create free account
hub / github.com/ccusage/ccusage / timestamp_value

Function timestamp_value

rust/crates/ccusage/src/adapter/codebuff/parser.rs:319–333  ·  view source on GitHub ↗
(value: Option<&Value>)

Source from the content-addressed store, hash-verified

317}
318
319fn timestamp_value(value: Option<&Value>) -> Option<crate::TimestampMs> {
320 match value? {
321 Value::String(value) => parse_ts_timestamp(value),
322 Value::Number(value) => {
323 let raw = value.as_i64()?;
324 let millis = if raw < 10_000_000_000 {
325 raw.checked_mul(1_000)?
326 } else {
327 raw
328 };
329 (millis > 0).then(|| crate::TimestampMs::from_millis(millis))
330 }
331 _ => None,
332 }
333}
334
335fn file_modified_timestamp(path: &Path) -> Option<crate::TimestampMs> {
336 let modified = fs::metadata(path).ok()?.modified().ok()?;

Callers 1

message_timestampFunction · 0.85

Calls 1

parse_ts_timestampFunction · 0.85

Tested by

no test coverage detected