Ejemplo n.º 1
0
    def setclock(self, txt=""):
        """ Set simulated clock time offset"""
        if txt == "":
            pass  # avoid error message, just give time

        elif txt.upper() == "RUN":
            self.deltclock = 0.0
            self.simtclock = self.simt

        elif txt.upper() == "REAL":
            tclock = time.localtime()
            self.simtclock = tclock.tm_hour * 3600. + tclock.tm_min * 60. + tclock.tm_sec
            self.deltclock = self.simtclock - self.simt

        elif txt.upper() == "UTC":
            utclock = time.gmtime()
            self.simtclock = utclock.tm_hour * 3600. + utclock.tm_min * 60. + utclock.tm_sec
            self.deltclock = self.simtclock - self.simt

        elif txt.replace(":", "").replace(".", "").isdigit():
            self.simtclock = txt2tim(txt)
            self.deltclock = self.simtclock - self.simt
        else:
            return False, "Time syntax error"

        return True, "Time is now " + tim2txt(self.simtclock)
Ejemplo n.º 2
0
    def setclock(self,txt=""):
        """ Set simulated clock time offset"""
        if txt == "":
            pass # avoid error message, just give time

        elif txt.upper()== "RUN":
            self.deltclock = 0.0
            self.simtclock = self.simt

        elif txt.upper()== "REAL":
            tclock = time.localtime()
            self.simtclock = tclock.tm_hour*3600. + tclock.tm_min*60. + tclock.tm_sec
            self.deltclock = self.simtclock - self.simt

        elif txt.upper()== "UTC":
            utclock = time.gmtime()
            self.simtclock = utclock.tm_hour*3600. + utclock.tm_min*60. + utclock.tm_sec
            self.deltclock = self.simtclock - self.simt

        elif txt.replace(":","").replace(".","").isdigit():
            self.simtclock = txt2tim(txt)
            self.deltclock = self.simtclock - self.simt
        else:
            return False,"Time syntax error"


        return True,"Time is now "+tim2txt(self.simtclock)
Ejemplo n.º 3
0
    def SetRTA(self, idx, name, txt):  # all arguments of setRTA
        """SetRTA acid, wpname, time: add RTA to waypoint record"""
        timeinsec = txt2tim(txt)
        if name in self.wpname:
            wpidx = self.wpname.index(name)
            self.wprta[wpidx] = timeinsec
            #print("Ik heb",self.wprta[wpidx],"op",self.wpname[wpidx],"gezet!")

        return True, ""
Ejemplo n.º 4
0
    def SetRTA(self, idx, name, txt):  # all arguments of setRTA
        """SetRTA acid, wpname, time: add RTA to waypoint record"""
        timeinsec = txt2tim(txt)
        #print(timeinsec)
        if name in self.wpname:
            wpidx = self.wpname.index(name)
            self.wprta[wpidx] = timeinsec
            #print("Ik heb",self.wprta[wpidx],"op",self.wpname[wpidx],"gezet!")

            # Recompute route and update actwp because of RTA addition
            self.direct(idx, self.wpname[self.iactwp])

        return True
Ejemplo n.º 5
0
    def SetRTA(self, idx, name, txt):  # all arguments of setRTA
        """SetRTA acid, wpname, time: add RTA to waypoint record"""
        timeinsec = txt2tim(txt)
        #print(timeinsec)
        if name in self.wpname:
            wpidx = self.wpname.index(name)
            self.wprta[wpidx] = timeinsec
            #print("Ik heb",self.wprta[wpidx],"op",self.wpname[wpidx],"gezet!")

            # Recompute if RTA waypoint is active waypoint
            if wpidx == self.iactwp:
                self.direct(idx, self.wpname[wpidx])

        return True, ""