summaryrefslogtreecommitdiff
path: root/ClockP.h
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2017-05-13 23:48:55 -0700
committerKeith Packard <keithp@keithp.com>2017-05-13 23:52:45 -0700
commit7ad730d892c899df3bb0b51a757ff2c55b6dc6d1 (patch)
tree465005e989ff00d09b8013bf19aa17c91cd112b4 /ClockP.h
parent9fa28e7fe8dc5e883211b29031446b42cbffe31f (diff)
Allow sub-second updates.
Lets you run the clock at whatever tick rate you like. Note that this changes the behaviour of the clock when the update isn't a divisor of the number of seconds in a day. In the old code, the time to display was an integer number of intervals from the start of the year, in the new code, it is an integer number of intervals from the start of the day. I like that better as it makes the seconds consistent from day to day, even if it means an uneven tick at local midnight. Given that I suspect no-one has ever done this in practice, I doubt it really matters. At least the code is simpler now, while supporting updates at the level of the Xt timers, which are milliseconds. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'ClockP.h')
-rw-r--r--ClockP.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/ClockP.h b/ClockP.h
index f8c84ee..632b65e 100644
--- a/ClockP.h
+++ b/ClockP.h
@@ -85,7 +85,7 @@ typedef struct {
GC HandGC; /* Hand GC */
GC HighGC; /* Highlighting GC */
/* start of graph stuff */
- int update; /* update period in second */
+ float update; /* update period in second */
Dimension radius; /* radius factor */
int backing_store; /* backing store type */
Boolean chime;
@@ -109,6 +109,7 @@ typedef struct {
XPoint *segbuffptr;
XPoint *hour, *sec;
struct tm otm ;
+ struct timeval otv ;
XtIntervalId interval_id;
char prev_time_string[STRFTIME_BUFF_SIZE];
#ifndef NO_I18N