-
-
Notifications
You must be signed in to change notification settings - Fork 797
Description
- I am on the latest ActivityWatch version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- OS name and version: Windows 11
- ActivityWatch version: Version: v0.13.2
Describe the bug
I noticed that there are gabs between window watcher events. These are small, but accumulate over a day and are dependent on polling size.
The window watcher reports times from start of occurrence and calculates a duration until the next event -1* polling duration (1s gab with 1s polling time, 5s gab with 5s polling time) which is wrong and leads to gabs:
E.g. (polling time 5s)
App1: 0.0 (reported duration 5s, actual duration 10s)
App2: 0.10 (reported duration 10s, actual duration 15s)
App3: 0.25 (reported duration 0s, actual duration 5s)
App4: 0.30
-> sum of all duration (15s), actual time (30s).
This is very noticeable if polling time is set to high values. But even at 1s this will lead to problems, esp. with programs which often switch title. E.g.:
App1: 0.0 (reported duration 0s, actual duration 1s)
App2: 0.1 (reported duration 3s, actual duration 4s)
App3: 0.5
-> sum (3s), actual time (5s)
When using a stopwatch, and high polling time, you can see very clearly both are diverging.
All of this started when I tracked my daily work time and was confused why the numbers would not add up. When I work 8h it only reported 7.5h, etc.
After investigation and looking into the exported .json files, I found the wrongly calculated duration.
To Reproduce
- Change polling time to 30s
- Use two apps >30s
- Repeat this a few times
- Check timeline
- Export bucket and check calculated times
Expected behavior
An application duration is until the next application, inclusive of the timestamp of the new application. There are no gabs.
Documentation
1s gab:
1s gab:
Polling time 5s (duration of explorer is 5s not 0s, others are off as well):
Polling time 1s:
Additional context
Probably related issues:
- [Android] Usage times are wrong #1136 (many Window switches with a second loss per switch can result in the inaccuracy)
- Editor times are not added to total for category #1093 (unsure)