Skip to content

Measurement capture_time does not correctly set timezone in datetime object #29

@karlHolmquist

Description

@karlHolmquist

Thank you for the code, I've noticed that the measurement capture_time is always returned as UTC in a python datetime object.
The issue is that the default constructor seems to be used, which means that the datetime.tzinfo field could be set to the local timezone instead of UTC, despite the timezone used in the capture process.

Could you update the wrapper so that the timezone is replaced with UTC:
mesu.capture_time.replace(tzinfo=datetime.timezone.utc)

OS: Ubuntu 22.04 docker on an Ubuntu 22.04 Jetson device

Note:
The issue could be because the 'RTC in local TZ' (from timedatectl) is set to true on the system which would limit the impact, but since it's probably pretty common, it would be better to correctly set timezone in the data anyway.

Thanks again

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