Show
Ignore:
Timestamp:
07/16/07 23:47:06 (6 years ago)
Author:
benoitg
Message:

Fix uptime formatting

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/node_list.php

    r1257 r1258  
    107107 
    108108if ($nodes_results == null) 
    109     throw new Exception(_("No nodes could not be found in the database")); 
     109throw new Exception(_("No nodes could not be found in the database")); 
    110110 
    111111$deploymentStatuses = array ( 
    112     "DEPLOYED" => _("Deployed" 
     112"DEPLOYED" => _("Deployed" 
    113113), "IN_PLANNING" => _("In planning"), "IN_TESTING" => _("In testing"), "NON_WIFIDOG_NODE" => _("Non-Wifidog node"), "PERMANENTLY_CLOSED" => _("Permanently closed"), "TEMPORARILY_CLOSED" => _("Temporarily closed")); 
    114114 
     
    118118    $node_row['duration'] = $db->GetDurationArrayFromIntervalStr($node_row['since_last_heartbeat']); 
    119119    if($node_row['last_heartbeat_wifidog_uptime']) { 
    120     $node_row['wifidog_uptime'] = $db->GetDurationArrayFromIntervalStr($node_row['last_heartbeat_wifidog_uptime'].' seconds'); 
     120        $previousRemainder = $node_row['last_heartbeat_wifidog_uptime']; 
     121        $remainder = $previousRemainder % (3600*24); 
     122        $node_row['wifidog_uptime']['days'] = ($previousRemainder - $remainder)  / (3600*24); 
     123        $previousRemainder = $remainder; 
     124        $remainder = $previousRemainder % (3600); 
     125        $node_row['wifidog_uptime']['hours'] = ($previousRemainder - $remainder)  / (3600); 
     126        $previousRemainder = $remainder; 
     127        $remainder = $previousRemainder % (60); 
     128        $node_row['wifidog_uptime']['minutes'] = ($previousRemainder - $remainder)  / (60); 
    121129    } 
    122130    $node_row['num_online_users'] = $node->getNumOnlineUsers();