uptime for Win XP?
Peter Hansen
peter at engcorp.com
Mon Dec 13 10:12:08 EST 2004
Richie Hindle wrote:
> [Greg]
>
>>>>import win32api
>>>>print "Uptime:", win32api.GetTickCount(), "Milliseconds"
>
> Note that in the unlikely event of your Windows machine being up for
> longer than 2^32 ms (about 49 days), GetTickCount() will wrap back to
> zero.
The real solution, in spite of the dozen alternatives we've
now produced, seems to be to use the win32pdh library
to access the "System"-> "System Up Time" value. It
claims to return an 8-byte value, which likely doesn't
wrap quite so soon. (And yes, remarkably, with the advent
of Windows XP Pro it is now possible to keep a Windows
machine running for longer than 49 days, even if it's
used as a development machine. Well, for Python development,
anyway. ;-)
For the life of me, however, I can't figure out how to do it.
-Peter
More information about the Python-list
mailing list