MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / timestamp

Function timestamp

crates/opencode-core/src/id.rs:87–96  ·  view source on GitHub ↗
(id: &str)

Source from the content-addressed store, hash-verified

85}
86
87pub fn timestamp(id: &str) -> Option<u64> {
88 let parts: Vec<&str> = id.split('_').collect();
89 if parts.len() != 2 {
90 return None;
91 }
92
93 let hex = parts[1].get(0..12)?;
94 let encoded = u64::from_str_radix(hex, 16).ok()?;
95 Some(encoded / 0x1000)
96}
97
98pub fn validate_prefix(id: &str, expected: Prefix) -> bool {
99 id.starts_with(expected.as_str())

Callers 1

Calls 1

getMethod · 0.45

Tested by 1