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.
()
| 481 | /// Only used when Copilot fails to provide a session_id, which should be |
| 482 | /// rare. Uses timestamp bits for uniqueness. |
| 483 | fn 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 |
no outgoing calls