MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / uuid_short

Function uuid_short

atomic-agent/src/hooks/copilot.rs:483–493  ·  view source on GitHub ↗

Generate a short hex string for fallback session IDs. Only used when Copilot fails to provide a session_id, which should be rare. Uses timestamp bits for uniqueness.

()

Source from the content-addressed store, hash-verified

481/// Only used when Copilot fails to provide a session_id, which should be
482/// rare. Uses timestamp bits for uniqueness.
483fn uuid_short() -> String {
484 use std::time::{SystemTime, UNIX_EPOCH};
485
486 let now = SystemTime::now()
487 .duration_since(UNIX_EPOCH)
488 .unwrap_or_default()
489 .as_millis();
490
491 // Use lower 32 bits of timestamp for a short hex ID
492 format!("{:08x}", (now & 0xFFFF_FFFF) as u32)
493}
494
495// =============================================================================
496// Tests

Callers 2

test_uuid_short_formatFunction · 0.70

Calls

no outgoing calls

Tested by 2

test_uuid_short_formatFunction · 0.56