Skip to content

Broken fidelity on datetime.fromtimestamp() #5

Closed
@cognitivegears

Description

@cognitivegears

Using datetime.fromtimestamp() is returning incorrect results due to a loss of precision in the underlying EPOC time. This causes the time to return the same result for multiple seconds, and then "jump", making the seconds value not reliable.

Tested on FeatherS2 and Raspberry Pi Pico.

Steps to reproduce:

import time
import adafruit_datetime as datetime
while True:
    datetime.datetime.fromtimestamp(time.time())
    time.sleep(1)

(observe the time not change second to second)

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