Sometimes it's useful to know how long your system has been running, or to use this information in scripts or other programs. I've developed a command line utility to do so on both Windows and Mac.
MacOS already comes with a built in "uptime" command, so I have named the utility "uptime2" to avoid a conflict. Both my Windows & Mac utilities offer a different feature set than built-in operating system utilities.
Windows
Windows doesn't ship with a single-line command to display uptime (unless you count Get-Uptime but that's in PowerShell only). Place this utility in your PATH to be able to both view the uptime for informational purposes and to be able to access it programatically via a batch file or other script. It will return the uptime as an exit code (in seconds).
uptime Displays uptime on screen and returns the uptime in seconds as the exit code / ErrorLevel
uptime -? Displays the syntax options and help
uptime -s Silent, displays no text but returns system uptime in seconds as the exit code / ErrorLevel
MacOS
MacOS comes with an uptime terminal command, but it displays it in a strange format (writes out the days then gives hours:minutes, and does not provide seconds). My utility will give a more consistent response, writing out days, hours, minutes and seconds. I would have loved to add the functionality as in the Windows version to return the uptime as a program exit code for use in scripts, however MacOS exit codes only range from 0-255 and this would quickly overflow. So instead, I changed the silent switch to return just the number of seconds of uptime to the console. You should be able to pipe that output into another script for processing.
uptime2 Displays precise uptime on screen in days, hours, minutes, seconds
uptime2 --? Displays the syntax options and help
uptime2 --s Only outputs uptime in total number of seconds