Example #1
0
 def setworktime(self, worktime):
     self._worktime = list(map(timef, worktime))
     for p in self.parents:
         self._worktime = intersection(self._worktime, p._worktime)
     self.delta = timedelta(minutes=(self.end.hour - self.start.hour) * 60 +
                            (self.end.minute - self.start.minute))
     if self.start == time.min and self.end == time.max:  # we have a microsecond delay
         self.delta = timedelta(hours=24)  # make it perfect
Example #2
0
def time_intersect(t1,t2):
    '''returns timedelta overlap between 2 intervals (tuples) of time'''
    a,b=interval.intersection(t1, t2)
    if not a:return timedelta0
    return time_sub(b,a)
        
Example #3
0
def time_intersect(t1, t2):
    '''returns timedelta overlap between 2 intervals (tuples) of time'''
    a, b = interval.intersection(t1, t2)
    if not a: return timedelta0
    return time_sub(b, a)