Skip to content

UTCTimeField EPOCH is confusing #4557

Closed
@douniwan5788

Description

@douniwan5788

scapy/scapy/data.py

Lines 270 to 271 in c38a5de

# On windows, epoch is 01/02/1970 at 00:00
EPOCH = calendar.timegm((1970, 1, 2, 0, 0, 0, 3, 1, 0)) - 86400

The comment is confusing. On Windows, the epoch is not 01/02/1970 at 00:00. It's just a bug bpo-29097 in the Python Windows version. By switching from time.mktime to calendar.timegm, we have already bypassed the bug. Just use normal calendar.timegm((1970, 1, 1, 0, 0, 0, 3, 1, 0)).

Also, 01/02/1970 is (1970, 1, 2, 0, 0, 0, 4, 2, 0), and we can always use 0 instead.

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