Example #1
0
    def putMilliseconds(self, milliSeconds):
        """Set the time given the number of milliseconds since the Epoch.

        milliSeconds The number of milli seconds past the Epoch."""
        timeStampPy._setSeconds(self.cppPvt, long(milliSeconds / 1000))
        nano = (milliSeconds % 1000) * 1000000
        timeStampPy._setNano(self.cppPvt, int(nano))
Example #2
0
    def putMilliseconds(self, milliSeconds):
        """Set the time given the number of milliseconds since the Epoch.

        milliSeconds The number of milli seconds past the Epoch."""
        timeStampPy._setSeconds(self.cppPvt, long(milliSeconds / 1000))
        nano = (milliSeconds % 1000) * 1000000
        timeStampPy._setNano(self.cppPvt, int(nano))
Example #3
0
    def put(self, secondsPastEpoch, nanoseconds=0):
        """Set the time.

        secondsPastEpoch The number of seconds since the Epoch.
        nanoseconds      The number of nano seconds within the second."""

        timeStampPy._setSeconds(self.cppPvt, long(secondsPastEpoch))
        timeStampPy._setNano(self.cppPvt, int(nanoseconds))
        self.normalize()
Example #4
0
    def put(self, secondsPastEpoch, nanoSeconds=0):
        """Set the time.

        secondsPastEpoch The number of seconds since the Epoch.
        nanoSeconds      The number of nano seconds within the second."""

        timeStampPy._setSeconds(self.cppPvt, long(secondsPastEpoch))
        timeStampPy._setNano(self.cppPvt, int(nanoSeconds))
        self.normalize()
Example #5
0
 def normalize(self):
     """Adjust secondsPastEpoch and nanoseconds so that
         0<=nanoseconds<nanoSecPerSec."""
     nano = self.getNanoseconds()
     if nano >= 0 and nano < TimeStamp.nanoSecPerSec:
         return
     secs = self.getSecondsPastEpoch()
     while nano >= TimeStamp.nanoSecPerSec:
         nano -= TimeStamp.nanoSecPerSec
         secs += 1
     while nano < 0:
         nano += TimeStamp.nanoSecPerSec
         secs -= 1
     timeStampPy._setSeconds(self.cppPvt, secs)
     timeStampPy._setNano(self.cppPvt, nano)
Example #6
0
 def normalize(self):
     """Adjust secondsPastEpoch and nanoSeconds so that
         0<=nanoSeconds<nanoSecPerSec."""
     nano = self.getNanoSeconds()
     if nano >= 0 and nano < TimeStamp.nanoSecPerSec:
         return
     secs = self.getSecondsPastEpoch()
     while nano >= TimeStamp.nanoSecPerSec:
         nano -= TimeStamp.nanoSecPerSec
         secs += 1
     while nano < 0:
         nano += TimeStamp.nanoSecPerSec
         secs -= 1
     timeStampPy._setSeconds(self.cppPvt, secs)
     timeStampPy._setNano(self.cppPvt, nano)
Example #7
0
    def __init__(self, secondsPastEpoch=0, nanoSeconds=0):
        """constructor

        secondsPastEpoch The number of seconds since
                         Jan 1, 1970 00:00:00 UTC.
        nanoSeconds      The number of nanoSeconds within current second."""
        if (not isinstance(secondsPastEpoch, int)) and (not isinstance(secondsPastEpoch, long)):
            raise TypeError("secondsPastEpoch is not an integer")
            return
        if (not isinstance(nanoSeconds, int)) and (not isinstance(nanoSeconds, long)):
            raise TypeError("nanoSeconds is not an integer")
            return
        self.cppPvt = timeStampPy._init()
        timeStampPy._setSeconds(self.cppPvt, secondsPastEpoch)
        timeStampPy._setNano(self.cppPvt, nanoSeconds)
        self.normalize()
Example #8
0
    def __init__(self, secondsPastEpoch=0, nanoseconds=0):
        """constructor

        secondsPastEpoch The number of seconds since
                         Jan 1, 1970 00:00:00 UTC.
        nanoseconds      The number of nanoseconds within current second."""
        if (not isinstance(secondsPastEpoch, int)) and (not isinstance(
                secondsPastEpoch, long)):
            raise TypeError("secondsPastEpoch is not an integer")
            return
        if (not isinstance(nanoseconds, int)) and (not isinstance(
                nanoseconds, long)):
            raise TypeError("nanoseconds is not an integer")
            return
        self.cppPvt = timeStampPy._init()
        timeStampPy._setSeconds(self.cppPvt, secondsPastEpoch)
        timeStampPy._setNano(self.cppPvt, nanoseconds)
        self.normalize()