def test_ctor_from_string(self): from persistent.timestamp import _makeUTC ZERO = _makeUTC(1900, 1, 1, 0, 0, 0) EPOCH = _makeUTC(1970, 1, 1, 0, 0, 0) DELTA = ZERO - EPOCH DELTA_SECS = DELTA.days * 86400 + DELTA.seconds SERIAL = b'\x00' * 8 ts = self._makeOne(SERIAL) self.assertEqual(ts.raw(), SERIAL) self.assertEqual(ts.year(), 1900) self.assertEqual(ts.month(), 1) self.assertEqual(ts.day(), 1) self.assertEqual(ts.hour(), 0) self.assertEqual(ts.minute(), 0) self.assertEqual(ts.second(), 0.0) self.assertEqual(ts.timeTime(), DELTA_SECS)
def test_ctor_from_string(self): from persistent.timestamp import _makeOctets from persistent.timestamp import _makeUTC ZERO = _makeUTC(1900, 1, 1, 0, 0, 0) EPOCH = _makeUTC(1970, 1, 1, 0, 0, 0) DELTA = ZERO - EPOCH DELTA_SECS = DELTA.days * 86400 + DELTA.seconds SERIAL = _makeOctets('\x00' * 8) ts = self._makeOne(SERIAL) self.assertEqual(ts.raw(), SERIAL) self.assertEqual(ts.year(), 1900) self.assertEqual(ts.month(), 1) self.assertEqual(ts.day(), 1) self.assertEqual(ts.hour(), 0) self.assertEqual(ts.minute(), 0) self.assertEqual(ts.second(), 0.0) self.assertEqual(ts.timeTime(), DELTA_SECS)