Exemplo n.º 1
0
    def test_conversion(self):
        t = CTime(0)

        self.assertEqual(t.value(), 0)
        self.assertEqual(t.ctime(), 0)
        self.assertEqual(t.time(), time.localtime(0))

        # These conversions depend on timezone
        utc = timezone('utc')
        local_timezone = timezone(CTime.timezone())

        localized_dt = local_timezone.localize(t.datetime())
        self.assertEqual(localized_dt.astimezone(utc), datetime(1970, 1, 1, 0, tzinfo=utc))

        localized_d = datetime(1970, 1, 1, 0, tzinfo=utc).astimezone(local_timezone)
        self.assertEqual(t.date(), localized_d.date())
Exemplo n.º 2
0
    def test_conversion(self):
        t = CTime(0)

        self.assertEqual(t.value(), 0)
        self.assertEqual(t.ctime(), 0)
        self.assertEqual(t.time(), time.localtime(0))

        # These conversions depend on timezone
        utc = timezone('utc')
        local_timezone = timezone(CTime.timezone())

        localized_dt = local_timezone.localize(t.datetime())
        self.assertEqual(localized_dt.astimezone(utc),
                         datetime(1970, 1, 1, 0, tzinfo=utc))

        localized_d = datetime(1970, 1, 1, 0,
                               tzinfo=utc).astimezone(local_timezone)
        self.assertEqual(t.date(), localized_d.date())
Exemplo n.º 3
0
 def getDate(self):
     """
     The date when this RFT/PLT/... was recorded. 
     """
     ct = CTime(self._get_date( ))
     return ct.date()
Exemplo n.º 4
0
 def date(self):
     """
     The date when this RFT/PLT/... was recorded.
     """
     ct = CTime(cfunc_rft.get_date(self))
     return ct.date()
Exemplo n.º 5
0
 def date(self):
     """
     The date when this RFT/PLT/... was recorded.
     """
     ct = CTime(cfunc_rft.get_date( self ))
     return ct.date()
Exemplo n.º 6
0
 def getDate(self):
     """
     The date when this RFT/PLT/... was recorded. 
     """
     ct = CTime(self._get_date())
     return ct.date()