Skrip Posted October 30, 2008 Posted October 30, 2008 You can get the last boot time, then get the current time, then subtract it out. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]
Developers Jos Posted October 30, 2008 Developers Posted October 30, 2008 Func PC_UPTIME() Local $day = "" Local $type = "" Local $hour = 0 Local $min = 0 Local $sec = 0 Local $uptime ; $ret = DllCall("kernel32.dll", "long", "GetTickCount") If IsArray($ret) Then $msec = StringRight("00" & Mod($ret[0], 1000), 3) $uptime = Int($ret[0] / 1000) $sec = StringRight("00" & Mod($uptime, 60), 2) If $uptime >= 60 Then $uptime = Int($uptime / 60) $min = StringRight("00" & Mod($uptime, 60), 2) If $uptime >= 60 Then $uptime = Int($uptime / 60) $hour = StringRight("00" & Mod($uptime, 24), 2) If $uptime >= 24 Then; convert hours to days $day = Int($uptime / 24) $type = "" If $day > 1 Then $type = "s" $type = " Day" & $type & " " EndIf EndIf EndIf Return ($day & $type & $hour & ":" & $min & ":" & $sec) EndIf EndFunc ;==>PC_UPTIME SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Duijst Posted February 2, 2009 Posted February 2, 2009 (edited) Func PC_UPTIME() ..... EndFunc;==>PC_UPTIMEThanks Jos, just what I needed. Henk-Sjoerd. Edited February 2, 2009 by Duijst
James Posted February 2, 2009 Posted February 2, 2009 Or this. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now