Programming Traditional Windowing Applications

Consider this small C program to write the time on the terminal:

#include <sys/types.h>
#include <sys/time.h>
main() {
  struct timeval tp; struct timezone tzp;
  struct tm *lt;
  long secs1970;
  gettimeofday(&tp, &tzp);
  secs1970= tp.tv_sec;
  lt = localtime(&secs1970);

lt->tm_hour, lt->tm_min, lt->tm_sec); }

A dozen lines of code, which will compile without change on any decent quality C compiler on any computer in the world.

Now consider the code below for an analogue clock (reduced to fit it on the page), a short example of the many examples of such clocks. A thousand plus lines of pure hell, catching events, and resizing windows, and goodness knows what, that will run on one computer only, for just one of the several windowing systems that run on that computer, which has not a single line in common with any of the other clock programs for that machine, and in fact has only a handful of lines in it that has anything to do with the concept of time at all.