Fellow Monks,
I am recording the system uptime of my machine with a script shown below. By the time it is up for 49 days and 22 hours. Windows (XP) tells me so and a few other programs, too. Since this morning my Perl Script tells me: Uptime: 0 days, 5 hours The machine definitely did not reboot. So what is wrong with Win32::GetTickCount()?
Of course, there is another script which parses the milliseconds in days, hours, etc. But the main point is that the value of Win32::GetTickCount() seems to overswap or seems to do something else in a way.
Has anyone an idea? Thanks :)
Here's the script:
#!C:/Perl/bin/perl
use strict;
use Win32;
use XML::Simple;
my ($uptime, $xml, $lastupdate);
while (1)
{
$uptime = Win32::GetTickCount();
$xml = XMLin("reg.xml", 'searchpath' => ['C:/Programme/Apache Grou
+p/Apache/cgi-bin/uptime'], 'noattr' => 1);
$xml->{'uptime'} = $uptime;
if ($uptime > $xml->{'record'})
{
$xml->{'record'} = $uptime;
}
$lastupdate = time();
$xml->{'lastupdate'} = $lastupdate;
XMLout($xml, 'outputfile' => 'C:/Programme/Apache Group/Apache/cgi
+-bin/uptime/reg.xml', 'noattr' => 1);
sleep(600);
}
exit;
BioHazard
reading between the lines is my real pleasure
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|