[or-cvs] r15035: (ticket:103) Adding uptime hours for less than 5 days (torstatus/trunk/web)

kasimir at seul.org kasimir at seul.org
Sun Jun 8 16:55:47 UTC 2008


Author: kasimir
Date: 2008-06-08 12:55:47 -0400 (Sun, 08 Jun 2008)
New Revision: 15035

Modified:
   torstatus/trunk/web/index.php
Log:
(ticket:103) Adding uptime hours for less than 5 days

Modified: torstatus/trunk/web/index.php
===================================================================
--- torstatus/trunk/web/index.php	2008-06-08 16:43:11 UTC (rev 15034)
+++ torstatus/trunk/web/index.php	2008-06-08 16:55:47 UTC (rev 15035)
@@ -759,8 +759,14 @@
 
   			case
 			($value == "Uptime"):
+
+			// Uptime is now in seconds, days and hours should
+			// be extracted
+
+			$printTimeHours = floor($record[$value]/86400) . "d " . floor(($record[$value] % 86400)/(60*60)) . "h";
+			$printTimeDays = floor($record[$value]/86400) . "d";
 			
-			if ($record[$value] > -1 && $record[$value] < 5)
+			if ($record[$value] > -1 && $record[$value] < 5*86400)
 			{
 				echo "<td class='TDc'>";
 				if ($record['Running'] == 0 && $record['Hibernating'] == 0)
@@ -771,7 +777,7 @@
 				{
 					echo "<img src='/img/blank.gif' alt=' ' width='12px' />";
 				}
-				echo $record[$value] . " d</td>";
+				echo $printTimeHours . "</td>";
 			}
 			else if ($record[$value] >= 5)
 			{
@@ -784,7 +790,7 @@
 				{
 					echo "<img src='/img/blank.gif' alt=' ' width='12px' />";
 				}
-				echo $record[$value] . " d</td>";
+				echo $printTimeDays . "</td>";
 			}
 			else
 			{
@@ -1571,7 +1577,7 @@
 
 if (in_array("Uptime", $ColumnList_ACTIVE))
 {
-	$query .= ", floor(CAST(((UNIX_TIMESTAMP() - (UNIX_TIMESTAMP($ActiveDescriptorTable.LastDescriptorPublished) + $OffsetFromGMT)) + $ActiveDescriptorTable.Uptime) AS SIGNED) / 86400) as Uptime";
+	$query .= ", floor(CAST(((UNIX_TIMESTAMP() - (UNIX_TIMESTAMP($ActiveDescriptorTable.LastDescriptorPublished) + $OffsetFromGMT)) + $ActiveDescriptorTable.Uptime) AS SIGNED)) as Uptime";
 }
 
 if (in_array("LastDescriptorPublished", $ColumnList_ACTIVE))



More information about the tor-commits mailing list