Example #1
0
 def get_next_tick(self):
     now = datetime.datetime.now()
     
     if self.second_sweep:
         next_tick = now + datetime.timedelta(0, 0.1)
     elif self.display_seconds:
         next_tick = now + datetime.timedelta(0, 1.0)
         next_tick = datetime.datetime(next_tick.year,next_tick.month,next_tick.day,next_tick.hour, next_tick.minute, int(next_tick.second))
     else:
         next_tick = now + datetime.timedelta(0, 60.0)
         next_tick = datetime.datetime(next_tick.year,next_tick.month,next_tick.day,next_tick.hour, next_tick.minute, 0)
         
     return g15pythonlang.total_seconds( next_tick - now )
Example #2
0
    def get_next_tick(self):
        now = datetime.datetime.now()

        if self.second_sweep:
            next_tick = now + datetime.timedelta(0, 0.1)
        elif self.display_seconds:
            next_tick = now + datetime.timedelta(0, 1.0)
            next_tick = datetime.datetime(next_tick.year, next_tick.month,
                                          next_tick.day, next_tick.hour,
                                          next_tick.minute,
                                          int(next_tick.second))
        else:
            next_tick = now + datetime.timedelta(0, 60.0)
            next_tick = datetime.datetime(next_tick.year, next_tick.month,
                                          next_tick.day, next_tick.hour,
                                          next_tick.minute, 0)

        return g15pythonlang.total_seconds(next_tick - now)
Example #3
0
 def _schedule_redraw(self):
     if not self.active:
         return
     
     '''
     Determine when to schedule the next redraw for. 
     '''        
     now = datetime.datetime.now()
     if self.display_seconds:
         next_tick = now + datetime.timedelta(0, 1.0)
         next_tick = datetime.datetime(next_tick.year,next_tick.month,next_tick.day,next_tick.hour, next_tick.minute, int(next_tick.second))
     else:
         next_tick = now + datetime.timedelta(0, 60.0)
         next_tick = datetime.datetime(next_tick.year,next_tick.month,next_tick.day,next_tick.hour, next_tick.minute, 0)
     delay = g15pythonlang.total_seconds( next_tick - now )
     
     '''
     Try not to create threads or timers if possible. Use g15scheduler.schedule) instead
     '''
     self.timer = g15scheduler.schedule("ClockRedraw", delay, self._redraw)
Example #4
0
 def _schedule_redraw(self):
     if not self.active:
         return
     '''
     Determine when to schedule the next redraw for. 
     '''
     now = datetime.datetime.now()
     if self.display_seconds:
         next_tick = now + datetime.timedelta(0, 1.0)
         next_tick = datetime.datetime(next_tick.year, next_tick.month,
                                       next_tick.day, next_tick.hour,
                                       next_tick.minute,
                                       int(next_tick.second))
     else:
         next_tick = now + datetime.timedelta(0, 60.0)
         next_tick = datetime.datetime(next_tick.year, next_tick.month,
                                       next_tick.day, next_tick.hour,
                                       next_tick.minute, 0)
     delay = g15pythonlang.total_seconds(next_tick - now)
     '''
     Try not to create threads or timers if possible. Use g15scheduler.schedule) instead
     '''
     self.timer = g15scheduler.schedule("ClockRedraw", delay, self._redraw)
Example #5
0
 def get_next_tick(self):
     return g15pythonlang.total_seconds( datetime.timedelta( seconds = 1 ))
Example #6
0
def total_seconds(time_delta):
    return g15pythonlang.total_seconds(time_delta)