From 4c4e3506198814bb99fcffa7c34b94a81ae35fa8 Mon Sep 17 00:00:00 2001 From: Harry Cutts Date: Fri, 9 Aug 2024 16:39:19 +0000 Subject: evemu-record: rename "boot" timestamp base to "epoch" My intention when I implemented this feature was that timestamps would be made relative to when the system booted, but I was mistaken about what timestamp base the Kernel events used and didn't test it thoroughly enough, as the feature ended up outputting Unix timestamps (i.e. relative to the epoch). This actually turns out to be more useful when matching the evemu recordings to other logs (since you can just turn the timestamps into dates and times directly, rather than having to work out when the system booted). So, let's just rename the command-line option and pretend this was what I intended all along... Bug: 343942561 Test: run `evemu-record --timestamp-base=epoch`, and check the timestamps in the output by comparing them to `date +%s` Flag: EXEMPT dev tool not used in any automation Change-Id: I80e3b4db1bcc2e6f656bfaaf7904f1678cfb29cf --- cmds/evemu-record/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmds/evemu-record/main.rs b/cmds/evemu-record/main.rs index db3fd77520..e91e5daec4 100644 --- a/cmds/evemu-record/main.rs +++ b/cmds/evemu-record/main.rs @@ -50,8 +50,10 @@ enum TimestampBase { /// The first event received from the device. FirstEvent, - /// The time when the system booted. - Boot, + /// The Unix epoch (00:00:00 UTC on 1st January 1970), so that all timestamps are Unix + /// timestamps. This makes the events in the recording easier to match up with those from other + /// log sources. + Epoch, } fn get_choice(max: u32) -> u32 { @@ -188,7 +190,7 @@ fn print_events( // // [0]: https://gitlab.freedesktop.org/libevdev/evemu/-/commit/eba96a4d2be7260b5843e65c4b99c8b06a1f4c9d TimestampBase::FirstEvent => event.time - TimeVal::new(0, 1), - TimestampBase::Boot => TimeVal::new(0, 0), + TimestampBase::Epoch => TimeVal::new(0, 0), }; print_event(output, &event.offset_time_by(start_time))?; loop { -- cgit v1.2.3-59-g8ed1b