Skip to content

TimeAlarm duration argument for simpler code without precision degradation #3989

Open
@kevinjwalters

Description

@kevinjwalters

The new alarm.time.TimeAlarm() function from #3767 takes two forms of absolute time as an argument. The 30bit fp number representation of time from time.monotonic() loses precision over time and this will impact users who use monotonic_time keyword argument. For most users a relative time will be easier to use and avoids this problem as the library can deal with maintaining best precision under the covers.

The example code:

pause = alarm.time.TimeAlarm(monotonic_time=time.monotonic() + 20)

would become:

pause = alarm.time.TimeAlarm(relative_time=20)

There may be better names for that new kwarg...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions