Skip to main content

SessionTimestamp

Function SessionTimestamp 

Source
pub fn SessionTimestamp() -> String
Expand description

Session timestamp in local time, cached once per process. MUST match whatever WindServiceHandlers.rs::"nativeHost:getEnvironmentPaths" builds, because VS Code’s file service writes window1/output/*.log into the directory that handler returns - if DevLog and VS Code use different timezones, Mountain.dev.log and the window1/ subtree land in two sibling directories 2-3 hours apart, which makes every post-mortem investigation start with “which folder has the real log?”. Picking chrono::Local::now() matches the VS Code convention (Tauri’s tauri-plugin-log also writes local-time YYYYMMDDTHHMMSS).

The format string is deliberately identical to the handler’s "%Y%m%dT%H%M%S", and both sides pull from the same OnceLock via SessionTimestamp() so re-entrant calls from anywhere in the codebase produce the same string.