Skip to content

strange timestamp #60

@Skill3t

Description

@Skill3t

Hey if i run the following script on Arm Cortex-A7 in a docker Container

from periphery import GPIO
from datetime import datetime
import time

all_gpio_list = []
c4l4 = GPIO("/dev/gpiochip4", 4, "in", edge="both")
all_gpio_list.append(c4l4)

while True:
    gpios = GPIO.poll_multiple(all_gpio_list, timeout=10)
    for gpio in gpios:
        event = gpio.read_event()
        print(event)
        print(datetime.now())
        print(time.time())

the output is:

EdgeEvent(edge='rising', timestamp=6212787543813)
2023-04-20 08:24:31.474127
1681979071.4748712

The timestamp of the event doesn't make any sense to me and I don't know how to convert it.
According to the documentation it should be a unix timestamp in nanoseconds.
So it should be something like this datetime.fromtimestamp(event.timestamp / 1000000) unfortunately it is not.

Do you have a hint for me?
Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions