Skip to content

StopTracking dbus method deletes activity when given an end time #775

@johnnyg

Description

@johnnyg

What

StopTracking doesn't work when given an end time

Steps to reproduce

  1. Start an activity
  2. Get the current unix timestamp: datetime.now().timestamp()
  3. 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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions