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

Function uuid_short

atomic-agent/src/hooks/copilot.rs:478–488  ·  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

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

Callers 2

test_uuid_short_formatFunction · 0.70

Calls

no outgoing calls

Tested by 2

test_uuid_short_formatFunction · 0.56