Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!mcf!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: comp.windows.x Subject: oclock changes to run ahead of true time Message-ID: <90056@elsie.UUCP> Date: 12 Feb 90 21:50:20 GMT Organization: NIH-LEC, Bethesda, MD Lines: 84 My father (Merrill Arthur) keeps clocks and watches five minutes ahead of "real time" to avoid being late for appointments. The trick has never worked for me, but if it works for you, the needed changes to "oclock" are attached. -- Arthur David Olson ado@alw.nih.gov ADO is a trademark of Ampex. *** 1.1/mit/clients/oclock/Clock.h Mon Feb 12 16:44:03 1990 --- 1.2/mit/clients/oclock/Clock.h Mon Feb 12 16:44:04 1990 *************** *** 16,19 **** --- 16,20 ---- Name Class RepType Default Value ---- ----- ------- ------------- + ahead Interval int 0 (seconds) background Background pixel White border BorderColor pixel Black *************** *** 33,36 **** --- 34,38 ---- #define XtNhour "hour" #define XtNjewel "jewel" + #define XtNahead "ahead" #ifdef SHAPE *** 1.1/mit/clients/oclock/ClockP.h Mon Feb 12 16:44:06 1990 --- 1.2/mit/clients/oclock/ClockP.h Mon Feb 12 16:44:07 1990 *************** *** 14,17 **** --- 14,18 ---- /* New fields for the clock widget instance record */ typedef struct { + int ahead; /* seconds to run ahead of true time */ Pixel minute; /* minute hand pixel */ Pixel hour; /* hour hand pixel */ *** 1.1/mit/clients/oclock/Clock.c Mon Feb 12 16:44:09 1990 --- 1.2/mit/clients/oclock/Clock.c Mon Feb 12 16:44:09 1990 *************** *** 20,23 **** --- 20,25 ---- static XtResource resources[] = { + {XtNahead, XtCInterval, XtRInt, sizeof(int), + offset(ahead), XtRImmediate, (caddr_t) 0 }, {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension), goffset(width), XtRString, "120"}, *************** *** 349,352 **** --- 351,355 ---- } (void) time (&now); + now += w->clock.ahead; tm = localtime (&now); if (tm->tm_hour >= 12) *** 1.1/mit/clients/oclock/oclock.c Mon Feb 12 16:44:13 1990 --- 1.2/mit/clients/oclock/oclock.c Mon Feb 12 16:44:13 1990 *************** *** 31,34 **** --- 31,36 ---- " [-minute {color}] [-hour {color}] [-jewel {color}]\n"); fprintf(stderr, + " [-ahead {seconds}]\n"); + fprintf(stderr, " [-backing {backing-store}]\n"); exit(1); *************** *** 44,47 **** --- 46,50 ---- {"-jewel", "*clock.jewel", XrmoptionSepArg, NULL}, {"-backing", "*clock.backingStore", XrmoptionSepArg, NULL}, + {"-ahead", "*clock.ahead", XrmoptionSepArg, NULL}, #ifdef SHAPE {"-shape", "*clock.shapeWindow", XrmoptionNoArg, "TRUE"}, *** 1.1/mit/clients/oclock/oclock.man Mon Feb 12 16:44:16 1990 --- 1.2/mit/clients/oclock/oclock.man Mon Feb 12 16:44:16 1990 *************** *** 44,47 **** --- 44,50 ---- causes the clock to not reshape itself and ancestors to exactly fit the outline of the clock. + .TP 8 + .B \-ahead \fIseconds\fB + causes the clock to run the given number of seconds ahead of true time. .SH COLORS Although the default colors for the Clock widget are black and white, the