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
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.