Created
January 2, 2012 09:46
-
-
Save stfnm/1550076 to your computer and use it in GitHub Desktop.
win32 sysuptime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use Win32; | |
my $time = Win32::GetTickCount(); | |
my $days = int($time / 1000 / 60 / 60 / 24); | |
my $hours = int(($time = ($time - $days * 1000 / 60 / 60 / 24)) / 1000 / 60 / 60); | |
my $min = int(($time = ($time - $hours * 1000 * 60 * 60)) / 1000 / 60); | |
my $sec = int(($time = ($time - $min * 1000 * 60)) / 1000); | |
print "System uptime: $days days, $hours hours, $min minutes, $sec seconds\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment