Thu, Jun 1, 2017 at 9:25 AM

With the recent announcement of FAST being empowered by FreeDOS, and
the interest on porting some UNIX utilities to DOS, I decided to
combine both.

Since current UPTIME v7.02 by Mark Aitchison is written in Turbo
Pascal, I tried to do an approach in fast. It is still WIP, and not
yet as complete as the other, but it is a mere COM file of 1.077
bytes, while the current version is 49.746.

What I like of my approach, is storing initial startup time on the
CMOS, using the unused alarm records, which is by far more efficient
than storing a file.

Hope you like the idea. Next steps will be parsing the command-line to
allow output in different formats, and try to mimic format such as:

08:11:22 up 146 days, 34 min, 3 users, load average: 0.28, 0.45, 0.38

Sources and binaries are available at:
http://javiergutierrezchamorro.com/wp-content/uploads/2017/07/uptime.zip

Once more complete, I will upload to my Sourceforge page:
https://www.sourceforge.net/projects/nikkhokkho

-Javier Gutiérrez Chamorro
guti.bitacoras.com@gmail.com


Introduction
UPTIME is a 16 bit DOS utility that display system uptime by automatically detecting when it was firstlyby automatically detecting when it was firstly booted. It replicates *NIX uptime, one of the basic UNIX commands which allows you to quickly confirm how long your system has been up and running since it was last rebooted or powered on.

Usage
UPTIME [-h|-r]

Examples:
UPTIME
Display current system uptime.

UPTIME -h
Shows this help screen.

UPTIME -r
Forces reseting the counter. Useful if it is not automatically detected	properly during startup.


Technical details
UPTIME uses CMOS data area to retrieve current system date/time using the RTC (Real Time Clock). Since CMOS area is persistent, it uses CMOS alarm registers, to store when the system was first startedup. Almost no DOS programs use alarm capabilities, but if so, running UPTIME, will overwrite them.

There are different approaches to UPTIME in DOS, such as UPTIME 7.02 by Mark Aitchison. His approach is to get system boottime, by reading NUL: file timestamp. Unfortunately, this approach is not working in DOSBox and other emulators.

UPTIME has been specially optimized to run on pure DOS enviroments, no matter if the are on the top of physical machines, or virtual machines. It is written using JWASM 2.12 beta, with x86 assembly using DOS tiny memory model in order to keep it compact.

Requirements
- MS-DOS 2.0 compatible or later.
- 8088 CPU or later.
- 2 Kb. of free disk space.
- 4 Kb. of free available memory.

Download
- DOS binaries and source code (5 Kb. in ZIP format.

History
2.40 - 2017/06/08
- 8086, 186 and 386 optimized versions.

2.30 - 2017/06/07
- Switched to ASMC 2.24.
- Added uppercase switches: -h, -H, -?, -r, -R, ...
- Added dash (-) and slash (/) switches separator: -h, /H.

2.20 - 2017/06/07
- Take advantage of proc uses to simplify code
- Remove GetAlarm time unused procedure.
- Other minor optimizations. Size reduced from 1.310 to 1.284 bytes.

2.10 2017/06/06
- Switch to UASM 2.35.
- Fixed waiting for key pressed in help.
- Size reduced from 1.312 to 1.310 bytes.

2.00 2017/06/06
- Totally rewritten in x86 assembler (JWASM 2.12).
- .COM size reduced in 40%.
- Added -r to force uptime reset.
- Improved CMOS check.

1.10 2017/06/02
- Formated output to mimic UNIX uptime.
- Added -h, -/, --help for help.
- Check CMOS is available.
- Increased capacity to 2147483648 seconds instead of 65535.
- Fixed uptime calculation.

1.00 2017/05/31
- First initial version.

License
UPTIME is provided free of charge covered by the GNU Lesser General Public License (LGPL).

Links
- Official UPTIME's website: nikkhokkho.sourceforge.net/static.php?page=UPTIME.

- Official author's website: www.javiergutierrezchamorro.com.

