Exemplo n.º 1
0
def convert(timeString):
    if timeString == 'now':
        return now()
    _sets = timeString.split(':')
    if len(_sets) != 7:
        return CF.UTCTime(0, 0, 0)
    _year, _month, _day, _blank, _hours, _minutes, _seconds = timeString.split(
        ':')
    _full_seconds = float(_seconds)
    _time = time.mktime(
        (int(_year), int(_month), int(_day), int(_hours), int(_minutes),
         int(_full_seconds), 0, 0, 0)) - time.timezone
    return CF.UTCTime(1, _time, _full_seconds - int(_full_seconds))
Exemplo n.º 2
0
def now():
    """
    Generates a CF.UTCTime object using the current 
    CPU time that you can use in the pushPacket call
    """
    ts = time.time()
    return CF.UTCTime(1, int(ts), ts - int(ts))
Exemplo n.º 3
0
def create(whole_secs=-1.0, fractional_secs=-1.0):
    """
    Generates a CF.UTCTime object using the current 
    CPU time that you can use in the pushPacket call
    """
    wsec = whole_secs
    fsec = fractional_secs
    if wsec < 0.0 and fsec < 0.0:
        ts = time.time()
        wsec = int(ts)
        fsec = ts - int(ts)

    return CF.UTCTime(1, wsec, fsec)
Exemplo n.º 4
0
def notSet():
    """
    Generates a CF.UTCTime object with zero time 
    and an invalid flag. This is used by the automatic EOS
    """
    return CF.UTCTime(1, 0.0, 0.0)