Skip to content

Windows 10: OverflowError: mktime argument out of range #302

Closed
@martin-neotech

Description

@martin-neotech

The C library function on windows 10 does not support times below a certain value.

https://github.com/neo4j/neo4j-python-driver/blob/4.0/neo4j/time/__init__.py#L239

    @classmethod
    def local_offset(cls):
        """ The offset from UTC for local time read from this clock.
        """
        return ClockTime(-int(mktime(gmtime(0))))

python time module

Although this module is always available, not all functions are available on all platforms. Most of the functions defined in this module call platform C library functions with the same name. It may sometimes be helpful to consult the platform documentation, because the semantics of these functions varies among platforms.

The epoch is the point where the time starts, and is platform dependent. For Unix, the epoch is January 1, 1970, 00:00:00 (UTC). To find out what the epoch is on a given platform, look at time.gmtime(0).

https://docs.python.org/3/library/time.html

>>> time.gmtime(0)
time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=0, tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)

>>> list((ix for ix in time.gmtime(0)))
[1970, 1, 1, 0, 0, 0, 3, 1, 0]

>>> time.mktime(time.gmtime(0))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: mktime argument out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions