; Show_Date_Time_of_Boot_and_Elapsed_Time_Since_Boot.ahk ; ; Partly by Apollia of Astroblahhh.Com. http://astroblahhh.com/ ; ; Thanks to the AHK forum member "closed" for the FormatSeconds function, ; which I (Apollia) slightly modified. I found it in boottime.zip ; (in the file boottime.ahk) at: ; ; http://www.autohotkey.com/forum/topic57396.html#351314 ; ; If you want a clock that shows the elapsed time since boot and which ; updates in real time, you might like boottime.zip more than this script. ; ; -------------------------------------------------------- ; ; This is a simple script that displays a message box showing the approximate ; date/time your computer booted and how many hours, minutes and seconds have ; elapsed since then. The elapsed time doesn't update. ; ; The times may be a little off - I'm not sure how to get rid of the 1 second ; fluctuation that sometimes happens. Sometimes, the date/time of booting ; ends up being 1 second earlier or 1 second later than the time usually ; displayed. #NoEnv #SingleInstance Force ; The FormatSeconds function is not by Apollia (though was slightly modified by ; Apollia). ; ; It is by the AHK forum member "closed", and I (Apollia) found it in boottime.zip ; (in the file boottime.ahk) at: ; ; http://www.autohotkey.com/forum/topic57396.html FormatSeconds(NumberOfSeconds) { time = 19990101 time += %NumberOfSeconds%, seconds FormatTime, mmss, %time%, mm:ss return Floor(NumberOfSeconds//3600) ":" mmss } DateFormat = ddd, M/d/yyyy h:mm:ss tt Now_DateTime := A_Now Boot_DateTime := Now_DateTime ; Will later subtract Seconds_Since_Boot to get boot time. Seconds_Since_Boot := A_TickCount / 1000 ;A_TickCount is a built-in variable containing milliseconds since boot. Negative_Seconds_Since_Boot := 0 - Seconds_Since_Boot EnvAdd, Boot_DateTime, Negative_Seconds_Since_Boot, Seconds FormatTime, Formatted_Now_DateTime, %Now_DateTime%, %DateFormat% FormatTime, Formatted_Boot_DateTime, %Boot_DateTime%, %DateFormat% Hours_Mins_and_Secs_Since_Boot:=FormatSeconds(Seconds_Since_Boot) MsgBox, (Times may be off by a sec or two)`n`nBoot Date/Time:`n`n %Formatted_Boot_DateTime%`n`nElapsed time since boot:`n`n %Hours_Mins_and_Secs_Since_Boot%`n`n(as of %Formatted_Now_DateTime%) exit