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

Function uuid_short

atomic-agent/src/hooks/pi.rs:551–561  ·  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

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

Callers 2

test_uuid_short_formatFunction · 0.70

Calls

no outgoing calls

Tested by 2

test_uuid_short_formatFunction · 0.56