Skip to content

numpy.uint64 ext_timestamp fail to split into correct ts, ns pairs #190

@tomkooij

Description

@tomkooij

See code below:

An ext_timestamp read from HDF5 is numpy.uint64 with different math rules (appearantly) as compared to int...

This might break a lot of (all) code that transforms ext_timestamp into ts, ns pairs.

(Fix: cast to int)

In [24]: ext_timestamp = 1547942403452849057
    ...: timestamp = int(ext_timestamp / int(1e9))
    ...: nanoseconds = int(ext_timestamp % int(1e9))
    ...: timestamp, nanoseconds
    ...:
Out[24]: (1547942403, 452849057)

In [25]: ext_timestamp % int(1e9)
Out[25]: 452849057

In [26]: et
Out[26]: 1547942403452849057

In [27]: et % int(1e9)
Out[27]: 452849152.0

In [28]: type(et)
Out[28]: numpy.uint64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions