[or-cvs] r23411: {arm} change: simplifying detection for if the date has changed (arm/trunk/src/interface)

Damian Johnson atagar1 at gmail.com
Tue Oct 5 16:51:20 UTC 2010


Author: atagar
Date: 2010-10-05 16:51:19 +0000 (Tue, 05 Oct 2010)
New Revision: 23411

Modified:
   arm/trunk/src/interface/logPanel.py
Log:
change: simplifying detection for if the date has changed



Modified: arm/trunk/src/interface/logPanel.py
===================================================================
--- arm/trunk/src/interface/logPanel.py	2010-10-05 16:44:47 UTC (rev 23410)
+++ arm/trunk/src/interface/logPanel.py	2010-10-05 16:51:19 UTC (rev 23411)
@@ -894,17 +894,14 @@
     responsive if additions are less frequent.
     """
     
-    # unix time for the start of the current day (local time), used so we
-    # can redraw when the date changes
-    currentTime = time.time()
-    dayStartTime = currentTime - (currentTime - TIMEZONE_OFFSET) % 86400
+    lastDay = daysSince() # used to determine if the date has changed
     while not self._halt:
-      currentTime = time.time()
-      timeSinceReset = currentTime - self._lastUpdate
+      currentDay = daysSince()
+      timeSinceReset = time.time() - self._lastUpdate
       maxLogUpdateRate = self._config["features.log.maxRefreshRate"] / 1000.0
       
       sleepTime = 0
-      if (self.msgLog == self._lastLoggedEvents and currentTime < dayStartTime + 86401) or self._isPaused:
+      if (self.msgLog == self._lastLoggedEvents and lastDay == currentDay) or self._isPaused:
         sleepTime = 5
       elif timeSinceReset < maxLogUpdateRate:
         sleepTime = max(0.05, maxLogUpdateRate - timeSinceReset)
@@ -914,7 +911,7 @@
         if not self._halt: self._cond.wait(sleepTime)
         self._cond.release()
       else:
-        dayStartTime = currentTime - (currentTime - TIMEZONE_OFFSET) % 86400
+        lastDay = currentDay
         self.redraw(True)
   
   def stop(self):



More information about the tor-commits mailing list