Tuesday, November 9, 2021

IBM PCjr From 1984 Keeps Today’s Clocks Running in Sync

A PCjr running an SNTP server

We’ve gotten used to the fact that the clocks on our internet-connected computers and smartphones are always telling the right time. Time servers, provided by a variety of government agencies as well as tech giants, provide them with the exact time and date thanks to accurate atomic clocks and the clever Network Time Protocol (NTP). But it wasn’t always like this: back in the 1990s when many computers didn’t have an internet connection, we had to adjust our computers’ clocks manually. Go back one more decade, and many PCs didn’t even have a battery-backed clock at all; you either set the proper date and time when the computer booted, or just lived with the fact that all new files were timestamped 01-01-1980.

[Michael Brutman] decided to mix today’s world of network time synchronization with the old world of batteryless PCs, and built an SNTP Time Server that runs on a DOS PC. He tried it with two different hardware setups: a 40 MHz 386 PC from 1993, and the (in)famous IBM PCjr from 1984. A standard GPS module serves as an accurate time reference; these units can often be directly connected to old hardware thanks to the eternal RS-232 standard.

Simply having an accurate clock was not enough though: the original IBM hardware had its internal clock only updated every 55 milliseconds, which is not fast enough for a proper NTP server. [Michael] therefore had to tweak the hardware clock’s update rate, taking care not to overload the CPU with too many interrupts. The slow CPU and limited memory anyway required him to implement the Simple Network Time Protocol (SNTP), a stripped-down version of the more common NTP, which leaves out some of the more complex features that deal with synchronizing multiple servers. The network interface is handled by [Michael]’s own mTCP package, which is a TCP/IP stack designed for DOS machines with limited memory.

Tests comparing the DOS time server to the one run by Google showed an offset of no more than a few milliseconds, which should be just fine for keeping all PCs on your home network in sync. Although using an old PC is not the most practical way to run your own time server, [Michael]’s blog post is a fascinating deep dive into the finer points of PC clock architecture and network time synchronization approaches. We’ve seen a time server implemented on ESP8266 hardware before; but you could also dispense with the (S)NTP protocol entirely and directly connect a GPS module to your Raspberry Pi for accurate timing.


No comments:

Post a Comment