Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTCTimeField EPOCH is confusing #4557

Closed
douniwan5788 opened this issue Oct 5, 2024 · 6 comments · May be fixed by #4564
Closed

UTCTimeField EPOCH is confusing #4557

douniwan5788 opened this issue Oct 5, 2024 · 6 comments · May be fixed by #4564

Comments

@douniwan5788
Copy link

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.

@douniwan5788
Copy link
Author

And The datetime object was not given any timezone information. Therefore, the %z in the strf format is always empty.

@gpotter2
Copy link
Member

gpotter2 commented Oct 6, 2024

Is there a bug? This is a bug tracker.

@douniwan5788
Copy link
Author

And The datetime object was not given any timezone information. Therefore, the %z in the strf format is always empty.

This is the bug

@gpotter2
Copy link
Member

gpotter2 commented Oct 8, 2024

Unless you can provide a reproducible example of failing code, and what's expected, I don't consider this a bug.

@gpotter2 gpotter2 closed this as completed Oct 8, 2024
@douniwan5788
Copy link
Author

Well... How to provide a reproducible example of code that never executes?

@gpotter2
Copy link
Member

gpotter2 commented Oct 8, 2024

If this does not cause any bug that has some sort of effect in the real world, it's not an issue and likely a waste of time.

I agree that Scapy contains code that is suboptimal, but don't open issues for code that you simply "don't like" yet works fine. For issues like that, my stance would rather be "make a PR or don't bother".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants