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

revisit time handling to ensure UTC everywhere #7

Closed
rouge8 opened this issue Oct 25, 2013 · 3 comments
Closed

revisit time handling to ensure UTC everywhere #7

rouge8 opened this issue Oct 25, 2013 · 3 comments
Assignees
Labels

Comments

@rouge8
Copy link

rouge8 commented Oct 25, 2013

Timezone dependent test failures; recheck all time handling code to ensure all timestamps are forced to utc or to naive with implied UTC.

Two of the ipfix.message tests fail when I run them against master:

$ python test.py
**********************************************************************
File "/Users/rouge8/forks/python-ipfix/ipfix/message.py", line 140, in ipfix.message
Failed example:
    for rec in msg.namedict_iterator():
       print(sorted(rec.items()))
Expected:
    [('destinationIPv4Address', IPv4Address('10.5.6.7')), ('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 12, 0, tzinfo=datetime.timezone.utc)), ('packetDeltaCount', 27), ('sourceIPv4Address', IPv4Address('10.1.2.3'))]
    [('destinationIPv4Address', IPv4Address('10.12.13.14')), ('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 12, 0, 2, tzinfo=datetime.timezone.utc)), ('packetDeltaCount', 33), ('sourceIPv4Address', IPv4Address('10.8.9.11'))]
    [('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 12, 0, 4, tzinfo=datetime.timezone.utc)), ('myNewInformationElement', "Grüezi, Y'all")]
Got:
    [('destinationIPv4Address', IPv4Address('10.5.6.7')), ('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 18, 0, tzinfo=datetime.timezone.utc)), ('packetDeltaCount', 27), ('sourceIPv4Address', IPv4Address('10.1.2.3'))]
    [('destinationIPv4Address', IPv4Address('10.12.13.14')), ('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 18, 0, 2, tzinfo=datetime.timezone.utc)), ('packetDeltaCount', 33), ('sourceIPv4Address', IPv4Address('10.8.9.11'))]
    [('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 18, 0, 4, tzinfo=datetime.timezone.utc)), ('myNewInformationElement', "Grüezi, Y'all")]
**********************************************************************
File "/Users/rouge8/forks/python-ipfix/ipfix/message.py", line 155, in ipfix.message
Failed example:
    for rec in msg.tuple_iterator(ielist):
        print(rec)
Expected:
    (datetime.datetime(2013, 6, 21, 12, 0, tzinfo=datetime.timezone.utc), 27)
    (datetime.datetime(2013, 6, 21, 12, 0, 2, tzinfo=datetime.timezone.utc), 33)
Got:
    (datetime.datetime(2013, 6, 21, 18, 0, tzinfo=datetime.timezone.utc), 27)
    (datetime.datetime(2013, 6, 21, 18, 0, 2, tzinfo=datetime.timezone.utc), 33)
**********************************************************************
1 items had failures:
   2 of  40 in ipfix.message
***Test Failed*** 2 failures.
@britram
Copy link
Owner

britram commented Oct 26, 2013

Let me guess, you're East Coast.

Python's time handling is deeply, deeply confused (a symptom of an
overly complicated design) and I've still not figured out how to
reliably force it to do everything in UTC, always. I was pretty sure the
code in ipfix.types handling time encode/decode worked, but apparently
failed to test on a machine not in UTC+2.

Will modify this issue to reflect the problem here.

Andy Freeland wrote:

Two of the |ipfix.message| tests fail when I run them against master:

|$ python test.py


File "/Users/rouge8/forks/python-ipfix/ipfix/message.py", line 140, in ipfix.message
Failed example:
for rec in msg.namedict_iterator():
print(sorted(rec.items()))
Expected:
[('destinationIPv4Address', IPv4Address('10.5.6.7')), ('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 12, 0, tzinfo=datetime.timezone.utc)), ('packetDeltaCount', 27), ('sourceIPv4Address', IPv4Address('10.1.2.3'))]
[('destinationIPv4Address', IPv4Address('10.12.13.14')), ('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 12, 0, 2, tzinfo=datetime.timezone.utc)), ('packetDeltaCount', 33), ('sourceIPv4Address', IPv4Address('10.8.9.11'))]
[('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 12, 0, 4, tzinfo=datetime.timezone.utc)), ('myNewInformationElement', "Grüezi, Y'all")]
Got:
[('destinationIPv4Address', IPv4Address('10.5.6.7')), ('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 18, 0, tzinfo=datetime.timezone.utc)), ('packetDeltaCount', 27), ('sourceIPv4Address', IPv4Address('10.1.2.3'))]
[('destinationIPv4Address', IPv4Address('10.12.13.14')), ('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 18, 0, 2, tzinfo=datetime.timezone.utc)), ('packetDeltaCount', 33), ('sourceIPv4Address', IPv4Address('10.8.9.11'))]
[('flowStartMilliseconds', datetime.datetime(2013, 6, 21, 18, 0, 4, tzinfo=datetime.timezone.utc)), ('myNewInformationElement', "Grüezi, Y'all")]


File "/Users/rouge8/forks/python-ipfix/ipfix/message.py", line 155, in ipfix.message
Failed example:
for rec in msg.tuple_iterator(ielist):
print(rec)
Expected:
(datetime.datetime(2013, 6, 21, 12, 0, tzinfo=datetime.timezone.utc), 27)
(datetime.datetime(2013, 6, 21, 12, 0, 2, tzinfo=datetime.timezone.utc), 33)
Got:
(datetime.datetime(2013, 6, 21, 18, 0, tzinfo=datetime.timezone.utc), 27)
(datetime.datetime(2013, 6, 21, 18, 0, 2, tzinfo=datetime.timezone.utc), 33)


1 items had failures:
2 of 40 in ipfix.message
_Test Failed_ 2 failures.
|


Reply to this email directly or view it on GitHub
#7.

@britram britram self-assigned this Mar 1, 2014
@britram britram added the bug label Mar 1, 2014
@britram
Copy link
Owner

britram commented Mar 1, 2014

Working on this in develop

@britram
Copy link
Owner

britram commented Mar 1, 2014

Well that was quick. Fixed in develop branch.

@britram britram closed this as completed Mar 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants