{"record":{"id":"ea4a71d5411804ea","repo":"emilk/egui","slug":"stopwatch-is-not-running","errorCode":null,"errorMessage":"Stopwatch is not running","messagePattern":"Stopwatch is not running","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/eframe/src/stopwatch.rs","lineNumber":26,"sourceCode":"    /// None = not running\n    start: Option<Instant>,\n}\n\nimpl Stopwatch {\n    pub fn new() -> Self {\n        Self {\n            total_time_ns: 0,\n            start: None,\n        }\n    }\n\n    pub fn start(&mut self) {\n        assert!(self.start.is_none(), \"Stopwatch already running\");\n        self.start = Some(Instant::now());\n    }\n\n    pub fn pause(&mut self) {\n        let start = self.start.take().expect(\"Stopwatch is not running\");\n        let duration = start.elapsed();\n        self.total_time_ns += duration.as_nanos();\n    }\n\n    pub fn resume(&mut self) {\n        assert!(self.start.is_none(), \"Stopwatch still running\");\n        self.start = Some(Instant::now());\n    }\n\n    pub fn total_time_ns(&self) -> u128 {\n        if let Some(start) = self.start {\n            // Running\n            let duration = start.elapsed();\n            self.total_time_ns + duration.as_nanos()\n        } else {\n            // Paused\n            self.total_time_ns\n        }","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/emilk/egui/blob/b9a0723d88dee87ba0965470b554a6efdab1d0bb/crates/eframe/src/stopwatch.rs#L8-L44","documentation":"Error \"Stopwatch is not running\" thrown in emilk/egui.","triggerScenarios":"Thrown at crates/eframe/src/stopwatch.rs:26 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call start() on the Stopwatch before calling pause(); pause() requires a running stopwatch."],"exampleFix":"let mut sw = Stopwatch::new(); sw.start(); /* ... */ sw.pause();","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b9a0723d88dee87ba0965470b554a6efdab1d0bb","analyzedAt":"2026-08-19T12:39:57.743Z","contentChangedAt":"2026-08-19T12:39:57.743Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}