Exemplo n.º 1
0
	def info(self):
		if self.running not in ("off","error"):
			tm = unixdelta(self.next-now())
		elif self.last is not None:
			tm = unixdelta(now()-self.last)
		else:
			tm = "never"
		return "%s %s" % (self.running,tm)
Exemplo n.º 2
0
Arquivo: avg.py Projeto: M-o-a-T/moat
	def weigth(self, mod=False):
		if self.value_tm is None:
			return None
		n = now()
		t = n-self.value_tm
		nt = self.total_tm+t
		nts = unixdelta(nt)
		if mod:
			self.total_tm = nt
		if nts == 0: ## called right after init'ing
			return 0
		else:
			return unixdelta(t) / nts
Exemplo n.º 3
0
 def weigth(self, mod=False):
     if self.value_tm is None:
         return None
     n = now()
     t = n - self.value_tm
     nt = self.total_tm + t
     nts = unixdelta(nt)
     if mod:
         self.total_tm = nt
     if nts == 0:  ## called right after init'ing
         return 0
     else:
         return unixdelta(t) / nts
Exemplo n.º 4
0
 def weigth(self, mod=False):
     if self.value_tm is None:
         return None
     t = now() - self.value_tm
     nt = unixdelta(t)
     if nt == 0:  ## called right after init'ing
         return 0
     else:
         return 1 - (1 - self.p)**(nt / self.p_base)
Exemplo n.º 5
0
Arquivo: avg.py Projeto: M-o-a-T/moat
	def weigth(self, mod=False):
		if self.value_tm is None:
			return None
		t = now()-self.value_tm
		nt = unixdelta(t)
		if nt == 0: ## called right after init'ing
			return 0
		else:
			return 1-(1-self.p)**(nt/self.p_base)
Exemplo n.º 6
0
	def time_int(self):
		if self.started_at is None:
			return None
		if not self.running.is_set():
			delta = now() - self.started_at
		elif self.job:
			delta = self.started_at - now()
		else:
			delta = now() - self.started_at
		return unixdelta(delta)
Exemplo n.º 7
0
def sleepUntil(force,delta):
	from moat.times import unixdelta,now,sleep

	if isinstance(delta,dt.datetime):
		delta = delta - now()
	if isinstance(delta,dt.timedelta):
		delta = unixdelta(delta)
	if delta < 0: # we're late
		delta = 0 # but let's hope not too late

	sleep(force,delta)
Exemplo n.º 8
0
def sleepUntil(force, delta):
    from moat.times import unixdelta, now, sleep

    if isinstance(delta, dt.datetime):
        delta = delta - now()
    if isinstance(delta, dt.timedelta):
        delta = unixdelta(delta)
    if delta < 0:  # we're late
        delta = 0  # but let's hope not too late

    sleep(force, delta)
Exemplo n.º 9
0
	def list(self):
		yield super(Timeslot,self)
		yield ("run",self.running)
		if self.interval is not None:
			yield ("interval"," ".join(str(x) for x in self.interval))
		yield ("duration",self.duration)
		if self.last is not None:
			yield ("last",self.last)
		if self.next is not None:
			yield ("next",self.next)
		if self.slotter is not None:
			yield ("slot",(unixdelta(self.next-now()))/self.duration)
Exemplo n.º 10
0
	def time_name(self):
		if self.started_at is None:
			return "never"
		if not self.running.is_set():
			delta = now() - self.started_at
		elif self.job:
			delta = self.started_at - now()
		else:
			delta = now() - self.started_at
		delta = unixdelta(delta)
		res = humandelta(delta)

		return u"‹"+res+"›"
Exemplo n.º 11
0
 def info(self):
     if self.total_samples == 0:
         return "(new)"
     return "%s %s" % (self._calc(), unixdelta(self.total_tm))
Exemplo n.º 12
0
Arquivo: wago.py Projeto: smurfix/MoaT
	def msg(self):
		delta = unixdelta(self.timer.end-now(True))
		if delta < 0.1: delta = 0.1
		return "%s %d %d %.3f" % ("s" if self.val else "c", self.card,self.port,delta)
Exemplo n.º 13
0
 def msg(self):
     delta = unixdelta(self.timer.end - now(True))
     if delta < 0.1: delta = 0.1
     return "%s %d %d %.3f" % ("s" if self.val else "c", self.card,
                               self.port, delta)
Exemplo n.º 14
0
Arquivo: avg.py Projeto: M-o-a-T/moat
	def info(self):
		if self.total_samples == 0:
			return "(new)"
		return "%s %s" % (self._calc(), unixdelta(self.total_tm))