-
Notifications
You must be signed in to change notification settings - Fork 255
Description
What
StopTracking doesn't work when given an end time
Steps to reproduce
- Start an activity
- Get the current unix timestamp:
datetime.now().timestamp() - Call the dbus method with the above timestamp
Expected behaviour
your current activity is ended with the end time set to the given time
Actual behaviour
your activity is deleted
Details
It seems that the dbus API uses (the deprecated) datetime.utcfromtimestamp on the given end time which means it constructs a (naive) datetime set to UTC however it then does comparisons with a (naive) datetime in the local timezone and notices that the end time is before the start time due to the timezone offset.
The solution here would be to just replace datetime.utcfromtimestamp with datetime.fromtimestamp.
I do realise that development has unfortunately pretty much halted on this project so if you're encountering this bug then the workaround is to add the timezone offset to the end time so that the resulting datetime is actually a local datetime (despite using the utcfromtimestamp).