C Papa Program Monday, March, 14, 2011 The completion of zotime over the weekend was a small personal success[1]. zotime is a small program that displays the current date and time in one or more time zones. It was inspired by the discovery that the Twenex command daytime only displays the time in the host computer's time zone, and doesn't even note what that time zone is. I guess the designers of TOPS-20 thought users of a given system would all be located within the system's time zone. Before the Internet that was a safe bet. Anyway, I decided I needed zotime so that I could see the time in my local zone, or any other. I toyed with the idea of programming it in assembler (Twenex's natural development language), but fearing a long learning curve decided to do it in C, which skill I'd recently started trying to improve. Although finding time to concentrate on programming was a challenge, the program came together fairly quickly. I'm particularly proud of zotime because it includes argument parsing, file processing, and character string handling, three areas of C that had seemed mysterious. After quite a bit of study, the string handling even avoids the common C security hole of buffer overflow. I got the programming running on Twenex, NetBSD, VMS, and my Zaurus (must try Ubuntu, too[2]) with only minor modifications. It's interesting to see that there are limits to portability even with the portable language C: the Twenex C compiler supports the K&R version of the language, so required non-prototype style function declarations; some compilers required stdlib.h to be explicitly included to use abs() while others didn't; common != standard -- libraries common on Linux and *BSD systems because they're part of GNU are far from universal (getopts). (A contemplated next project includes a file system directory traversal, and there even C gives up trying to be portable: it's all dependent on system-unique libraries.) * Notes [1] This weekend I also spent a lot of time in front of the television awestruck by the scale of destruction caused by the Great East Japan Earthquake, A terrible and historic human tragedy. [2] Update March 19, 2011: It runs on Ubuntu, too.