ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/host/generic/statgrab.pl
(Generate patch)

Comparing projects/cms/source/host/generic/statgrab.pl (file contents):
Revision 1.20 by tdb, Sun Feb 4 22:38:41 2001 UTC vs.
Revision 1.21 by tdb, Sun Feb 4 23:40:39 2001 UTC

# Line 193 | Line 193 | sub include_osver() {
193   # sub to get system uptime.
194   sub include_uptime() {
195  
196 +    # grab the uptime
197      my($uptime) = `$uptimebin`;
198 <    $uptime =~ /up ([0-9]+) .*, ([0-9]+:[0-9]+)/;
199 <    $uptime = "$1:$2";
198 >
199 >    # work out the days, hours, and minutes
200 >    if ($uptime =~ /hr/) {
201 >      # 0 minutes
202 >        $uptime =~ /up ([0-9]+) .*, ([0-9]+) .*,/;
203 >        $uptime = "$1:$2:0";
204 >    }
205 >    elsif ($uptime =~ /min/) {
206 >      # 0 hours
207 >        $uptime =~ /up ([0-9]+) .*, ([0-9]+) .*,/;
208 >        $uptime = "$1:0:$2";
209 >    }
210 >    elsif ($uptime =~ /day/) {
211 >      # normal
212 >        $uptime =~ /up ([0-9]+) .*, ([0-9]+):([0-9]+)/;
213 >        $uptime = "$1:$2:$3";
214 >    }
215 >    else {
216 >      # 0 days
217 >        $uptime =~ /up ([0-9]+):([0-9]+)/;
218 >        $uptime = "0:$1:$2";
219 >    }
220 >
221 >    # turn into minutes
222 >
223 >    $uptime =~ /([0-9]+):([0-9]+):([0-9]+)/;
224 >    $uptime = $3 + ($2 + $1*24)*60;
225  
226      &print_pair(0, "packet.os.uptime", $uptime);
227  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines