![]()
Here is a short little program I made for Windows, in Fortran of all things!
This program tells you how long your computer has been on. It’ll also tell you when it was last restarted (when you turned it on, or rebooted) and the current time:
C:\code>uptime.exe Current time : Sat Jun 16 15:47:03 2018 Last Restart : Sat Jun 16 14:08:21 2018 Elapsed time : 1h 38m 42s Press Enter/Return to close... C:\code>
You don’t need to access it this way; simply double-clicking on it will open a window and show you this info as well. Additionally, there’s more to this program than just above. Passing the ‘-help’ argument to it gives you details:
C:\code>uptime.exe -help Fortran based up time clock, version 1.0 prints out current time, last restart and elapsed time ignores any time computer spent in hibernation or sleep mode accepts the following arguments: -v, -l verbose, long form; prints out additional time related information -c close; auto closes program after running, no need to hit Enter/Return -s short form; print out just elapsed time in a readable form and quit -h help; show this information and quit C:\code>
So, the short form will get you this:
C:\code>uptime.exe -s 1h 50m 16s
And the long form will give you this:
C:\code>uptime.exe -l -c Current time : Sat Jun 16 16:00:50 2018 Standard resolution clock: Last Restart : Sat Jun 16 14:08:21 2018 Elapsed time : 1h 52m 29s Clock rate : 1,000 counts/sec Rollover in : 24d 18h 38m 54s Rollover at : Wed Jul 11 10:39:44 2018 High resolution clock: Last Restart : Sat Jun 16 14:08:20 2018 Elapsed time : 1h 52m 30s Clock rate : 3,320,400 counts/sec Rollover in : 88024y 234d 18h 34m 22s Difference : 0.42084s Drift (s/s) : 6.2350E-05 Process time : 0.0016974s C:\code>
It really has access to two clocks; the standard and the high res clock. The outputs that are not the long form seen here will switch to the high res clock to show uptime if the standard clock has rolled over, so you’ll still be able to tell how long your computer’s been on if it’s been on for more than 24 days.
You can download the program HERE
And the Fortran code is HERE
I compiled it with Gfortran via mingw64. As for the icon, I made it in Python with PIL.
Leave a comment