Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Uptime with Win32::GetTickCount()

by BrowserUk (Patriarch)
on Dec 02, 2002 at 12:29 UTC ( #216897=note: print w/replies, xml ) Need Help??


in reply to Uptime with Win32::GetTickCount()

The problem is that the value is either being stored by Windows (or possible returned by Win32::GetTickCount() I haven't been able to find the info on this yet) as an 32-bit value. This gives a maximimum milliseconds counts of 4294967295 which translates to 49 days 15 hours 37 minutes 33.354 seconds.

If I manage to locate the information as to whether this is an OS limitation or if its the module wrapper that is throwing information away, I'll update this post.

Update: I found an appropriate page on msdn

The elapsed time is stored as a DWORD value. Therefore, the time will wrap around to zero if the system is run continuously for 49.7 days.

Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.

Replies are listed 'Best First'.
Re: Re: Uptime with Win32::GetTickCount()
by BioHazard (Pilgrim) on Dec 02, 2002 at 13:52 UTC
    Thanks a lot :)
    Too bad for people with the "Uptime-Hobby"

    I am quite lazy right now and just added the line
    $uptime += 4294967295;
    to my script. I know that I have to do this again in 49.7 days ;-)
    But is there perhaps another method or another module which gets another system (uptime) variable? There must be a environment variable showing the correct uptime, because Windows tells me the correct value and a program called "tuxtime uptime client" ( tuxtime community ) as well.

    BioHazard
    reading between the lines is my real pleasure

      A quick google turned up this perl script which uses various means to work around the 49 day roll-over under windows of various flavours.

      The relevant bit for win2k is the bit that locates the 6005 event in the event log.


      Okay you lot, get your wings on the left, halos on the right. It's one size fits all, and "No!", you can't have a different color.
      Pick up your cloud down the end and "Yes" if you get allocated a grey one they are a bit damp under foot, but someone has to get them.
      Get used to the wings fast cos its an 8 hour day...unless the Govenor calls for a cyclone or hurricane, in which case 16 hour shifts are mandatory.
      Just be grateful that you arrived just as the tornado season finished. Them buggers are real work.

[OT] Uptime with Win32::GetTickCount()
by crenz (Priest) on Dec 02, 2002 at 13:54 UTC

    This gives a maximimum milliseconds counts of 4294967295 which translates to 49 days 15 hours 37 minutes 33.354 seconds.

    Which, incidentially, made earlier versions of Windows crash after this amount of uptime. Not that I ever heard of anyone having an uptime of 49 days with Win 95, though. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://216897]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2022-10-07 21:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (30 votes). Check out past polls.

    Notices?