def findReceivedPair(self, packageReceivedList): tsUpperLimit = util.addSecs(self.sent.timestamp, 30).timestamp() tsLowerLimit = util.addSecs(self.sent.timestamp, -30).timestamp() for receivedPkg in packageReceivedList: if receivedPkg.timestamp > tsUpperLimit: break elif receivedPkg.timestamp < tsLowerLimit: continue elif (receivedPkg.id == self.sent.id): self.received = receivedPkg self.__calculateMetrics__() return True return False
def onIncr(self, evt): idx = self.rectcb.GetCurrentSelection() y, m, d, h, mi, s = int(self.year.GetValue()), int(self.month.GetValue()), int(self.day.GetValue()), int(self.hour.GetValue()), int(self.minute.GetValue()), int(self.sec.GetValue()) if idx == PrimDirsListFrame.SEC1 or idx == PrimDirsListFrame.SEC5 or idx == PrimDirsListFrame.SEC10: sadd = 1 if idx == PrimDirsListFrame.SEC5: sadd = 5 if idx == PrimDirsListFrame.SEC10: sadd = 10 y, m, d, h, mi, s = util.addSecs(y, m, d, h, mi, s, sadd) else: madd = 1 if idx == PrimDirsListFrame.MIN5: madd = 5 if idx == PrimDirsListFrame.MIN10: madd = 10 y, m, d, h, mi = util.addMins(y, m, d, h, mi, madd) self.year.SetValue(str(y)) self.month.SetValue(str(m).zfill(2)) self.day.SetValue(str(d).zfill(2)) self.hour.SetValue(str(h)) self.minute.SetValue(str(mi).zfill(2)) self.sec.SetValue(str(s).zfill(2))
def onIncrSec(self, event): y, m, d, h, mi, s = util.addSecs(self.chart.time.origyear, self.chart.time.origmonth, self.chart.time.origday, self.chart.time.hour, self.chart.time.minute, self.chart.time.second, 1) self.show(y, m, d, h, mi, s)
def receivePackage(self, eth, receivedDatetimePackage): print('Recebendo pacote ' + str(len(self.__packageList))) self.__addPackage(eth, receivedDatetimePackage) if len(self.__packageList) <= 0: self.__addPackage(eth, receivedDatetimePackage) else: dtLastPackgReceived = self.__packageList[-1].getReceivedDTPackg() dtLimit = util.addSecs(dtLastPackgReceived, self.__maxTimeInSecBetweenPackages) if (dtLimit > datetime.datetime.fromtimestamp(receivedDatetimePackage)): self.__packageList = list() self.__addPackage(eth, receivedDatetimePackage)
def generateReps(self): self.reps = [] startTS = self.listPackageClient[0].timestamp endTS = self.listPackageServer[-1].timestamp while (startTS <= endTS): endTSAux = util.addSecs(startTS, SECONDS_FOR_EACH_REP).timestamp() print('\nProcessando repetição {}: de {} à {}'.format( len(self.reps), util.getFormattedDatetimeWithMillisec(startTS), util.getFormattedDatetimeWithMillisec(endTSAux), )) self.reps.append( Repetition(len(self.reps), startTS, endTSAux, self.listPackageClient, self.listPackageServer)) startTS = endTSAux