~unity-2d-team/unity-2d/Shell-MultiMonitor

« back to all changes in this revision

Viewing changes to grackle/tests/test_model.py

  • Committer: William Grant
  • Date: 2012-01-23 05:57:50 UTC
  • Revision ID: william.grant@canonical.com-20120123055750-veg4p0rv3fnef9z3
So it turns out that calendar.timegm is a UTC equivalent of time.mktime.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
__metaclass__ = type
18
18
 
 
19
import calendar
19
20
import datetime
20
21
from email.utils import formatdate
21
22
import os
22
23
from tempfile import _RandomNameSequence
23
 
import time
24
24
import unittest
25
25
 
26
26
from dateutil.tz import (
86
86
        self.assertEqual(key, archive_messages[0][1])
87
87
 
88
88
        # The key in archive_message is a TimeUUID for the Date field in
89
 
        # the message. There is no UTC equivalent of time.mktime, so we
90
 
        # must subtract the offset.
91
 
        utctime = time.mktime(datetime.datetime(
92
 
            2000, 1, 1, 0, 2, 34, tzinfo=tzutc()).timetuple()) - time.timezone
 
89
        # the message.
 
90
        utctime = calendar.timegm(datetime.datetime(
 
91
            2000, 1, 1, 0, 2, 34, tzinfo=tzutc()).timetuple())
93
92
        self.assertEqual(
94
93
            utctime,
95
94
            convert_uuid_to_time(archive_messages[0][0]))