4.2.6 Real-Time Clock Control

Programs can open the clock device for reading and writing. Reading from the clock device always returns three 16-bit values. These values are the low, middle, and high parts of the system time, representing the number of milliseconds elapsed since January 1, 1980. Writing to the clock device overwrites all three values and changes the system time for MS-DOS and all other programs.

To ensure compatibility with future versions of MS-DOS and with other operating environments, programs should avoid accessing the clock device directly. Instead, they should use Get Date (Interrupt 21h Function 2Ah), Set Date (Interrupt 21h Function 2Bh), Get Time (Interrupt 21h Function 2Ch), and Set Time (Interrupt 21h Function 2Dh) to get and set the system time.