Esempio n. 1
0
 def test_datetime_to_python(self):
     from celerymanagementapp.timeutil import datetime_to_python
     now = datetime.datetime.now()
     # Resolution is in milliseconds.  Strip off smaller values.
     microsecond = now.microsecond - now.microsecond%1000
     now = now.replace(microsecond=microsecond)
     ms = int(time.mktime(now.timetuple())*1000 + now.microsecond/1000.)
     self.assertEquals(now, datetime_to_python(ms))
Esempio n. 2
0
 def test_datetime_to_python2(self):
     from celerymanagementapp.timeutil import datetime_to_python
     tz = self.tz_offset()*1000
     D = datetime.datetime
     self.assertEquals(D(1970,1,1), datetime_to_python(0+tz))
     self.assertEquals(D(2000,1,1), datetime_to_python(946684800000+tz))