[comp.windows.x] xclock changes to run ahead of true time

ado@elsie.UUCP (Arthur David Olson) (02/13/90)

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 "xclock" are attached.
-- 
	Arthur David Olson   ado@alw.nih.gov   ADO is a trademark of Ampex.

*** 1.1/mit/lib/Xaw/Clock.h	Mon Feb 12 16:43:10 1990
--- 1.2/mit/lib/Xaw/Clock.h	Mon Feb 12 16:43:10 1990
***************
*** 43,46 ****
--- 43,47 ----
   Name		     Class		RepType		Default Value
   ----		     -----		-------		-------------
+  ahead               Interval           int             0 (seconds)
   analog		     Boolean		Boolean		True
   background	     Background		Pixel		white
***************
*** 79,82 ****
--- 80,86 ----
  		/* Int: amount of space around outside of clock */
  #define XtNpadding "padding"
+ 
+ 		/* Int: amount to set clock ahead */
+ #define XtNahead "ahead"
  
  typedef struct _ClockRec *ClockWidget;  /* completely defined in ClockPrivate.h */
*** 1.1/mit/lib/Xaw/ClockP.h	Mon Feb 12 16:43:12 1990
--- 1.2/mit/lib/Xaw/ClockP.h	Mon Feb 12 16:43:13 1990
***************
*** 49,52 ****
--- 49,53 ----
  	 GC	HighGC;		/* Highlighting GC */
  /* start of graph stuff */
+ 	 int	ahead;		/* amount to set clock ahead */
  	 int	update;		/* update frequence */
  	 Dimension radius;		/* radius factor */
*** 1.1/mit/lib/Xaw/Clock.c	Mon Feb 12 16:43:15 1990
--- 1.2/mit/lib/Xaw/Clock.c	Mon Feb 12 16:43:16 1990
***************
*** 64,67 ****
--- 64,69 ----
  
  static XtResource resources[] = {
+     {XtNahead, XtCInterval, XtRInt, sizeof(int), 
+         offset(ahead), XtRImmediate, (caddr_t) 0 },
      {XtNwidth, XtCWidth, XtRDimension, sizeof(Dimension),
  	goffset(width), XtRImmediate, (caddr_t) 0},
***************
*** 172,175 ****
--- 174,178 ----
         long time_value;
         (void) time(&time_value);
+        time_value += w->clock.ahead;
         tm = *localtime(&time_value);
         str = asctime(&tm);
***************
*** 305,308 ****
--- 308,312 ----
  				w->clock.update*1000, clock_tic, (caddr_t)w );
  	(void) time(&time_value);
+ 	time_value += w->clock.ahead;
  	tm = *localtime(&time_value);
  	/*
*** 1.1/mit/clients/xclock/xclock.c	Mon Feb 12 16:43:19 1990
--- 1.2/mit/clients/xclock/xclock.c	Mon Feb 12 16:43:19 1990
***************
*** 56,59 ****
--- 56,60 ----
  {"-digital",	"*clock.analog",	XrmoptionNoArg,		"FALSE"},
  {"-analog",	"*clock.analog",	XrmoptionNoArg,		"TRUE"},
+ {"-ahead",	"*clock.ahead",		XrmoptionSepArg,	NULL},
  };
  
***************
*** 76,79 ****
--- 77,81 ----
  	(void) printf ("       [-fn <font_name>] [-help] [-padding <pixels>]\n");
  	(void) printf ("       [-rv] [-update <seconds>] [-display displayname]\n");
+ 	(void) printf ("       [-ahead <seconds>]\n");
  	(void) printf ("       [-geometry geom]\n\n");
  	exit(1);
*** 1.1/mit/clients/xclock/xclock.man	Mon Feb 12 16:43:22 1990
--- 1.2/mit/clients/xclock/xclock.man	Mon Feb 12 16:43:22 1990
***************
*** 23,26 ****
--- 23,30 ----
  printed on the standard error.
  .TP 8
+ .B \-update \fIseconds\fP
+ This option indicates that the clock should run the given number of seconds
+ ahead of the true time.  The default is zero seconds.
+ .TP 8
  .B \-analog 
  This option indicates that a conventional 12 hour clock face with tick marks