コード例 #1
0
ファイル: day.py プロジェクト: pombreda/MoaT
	def _range(self,start,end):
		#
		#txt = self.descr.split()
		def j(x):
			for y in x:
				for z in y:
					if z:
						yield z
		txt=list(j(TimeSplit.findall(self.descr)))
		start = make_naive(start,get_current_timezone())
		end = make_naive(end,get_current_timezone())
		while start < end:
			a = time_until(txt, invert=False, now=start)
			b = time_until(txt, invert=True, now=a)
			if b is None:
				import pdb;pdb.set_trace()
				b = time_until(txt, invert=True, now=a)
			yield (make_aware(a,get_current_timezone()), b-a)
			start=b
コード例 #2
0
ファイル: monitor.py プロジェクト: smurfix/HomEvenT
	def _schedule(self):
		"""Sleep until the next time this monitor should run"""
		s = self.stopped_at or now()
		if self.delay_for:
			if isinstance(self.delay_for,tuple):
				s = time_delta(self.delay_for, now=s)
			else:
				s += dt.timedelta(0,self.delay_for)
		if self.delay_until:
			if self.stopped_at:
				s = time_until(self.delay_until, now=s, invert=True)
			s = time_until(self.delay_until, now=s)
		if not self.delay_for and not self.delay_until:
			if isinstance(self.delay,tuple):
				s = time_delta(self.delay, now=s)
			else:
				s += dt.timedelta(0,self.delay)

		self.started_at = s
		with log_wait("monitor","sleep",*self.name):
			sleepUntil(False,s)
コード例 #3
0
ファイル: mod_timecalc.py プロジェクト: pombreda/MoaT
def chk(iso,a,invert=False):
	if a == "":
		a = ()
	else:
		a = a.split(" ")
	res = time_until(a,now=now,invert=invert)
	if res is None:
		if iso == "-": return
	res -= datetime.timedelta(0,0,res.microsecond)
	res = str(res)
	if iso == res: return

	global err
	global lnp
	if lnp is None or lnp != now:
		lnp = now
		print "@",now,"::"
	err += 1
	print "?",iso,"≠",res,"@",a
コード例 #4
0
ファイル: delay.py プロジェクト: pombreda/MoaT
		def delta():
			return time_until(event, now=now(self.parent.force))
コード例 #5
0
ファイル: delay.py プロジェクト: pombreda/MoaT
		def delta():
			s = time_until(event, invert=True, now=now(self.parent.force))
			return time_until(event, now=s)