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

Function uuid_short

atomic-agent/src/hooks/pi.rs:554–564  ·  view source on GitHub ↗

Generate a short hex string for fallback session IDs. This is only used when the Pi extension fails to provide a session_id, which should be rare. Uses timestamp bits for uniqueness.

()

Source from the content-addressed store, hash-verified

552/// This is only used when the Pi extension fails to provide a session_id,
553/// which should be rare. Uses timestamp bits for uniqueness.
554fn uuid_short() -> String {
555 use std::time::{SystemTime, UNIX_EPOCH};
556
557 let now = SystemTime::now()
558 .duration_since(UNIX_EPOCH)
559 .unwrap_or_default()
560 .as_millis();
561
562 // Use lower 32 bits of timestamp for a short hex ID
563 format!("{:08x}", (now & 0xFFFF_FFFF) as u32)
564}
565
566// Pi hook verb → HookType mapping
567

Callers 2

test_uuid_short_formatFunction · 0.70

Calls

no outgoing calls

Tested by 2

test_uuid_short_formatFunction · 0.56