From 1341e2a42978beacf1e038dc6198ca8566b68fbf Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Wed, 13 Jan 1999 15:58:33 +0000 Subject: [PATCH] Fl_Clock fixes for WIN32 from Bill. git-svn-id: file:///fltk/svn/fltk/trunk@215 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Clock.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Fl_Clock.cxx b/src/Fl_Clock.cxx index 91e9155a2..c1f1966b5 100644 --- a/src/Fl_Clock.cxx +++ b/src/Fl_Clock.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Clock.cxx,v 1.5 1999/01/13 15:45:49 mike Exp $" +// "$Id: Fl_Clock.cxx,v 1.6 1999/01/13 15:58:33 mike Exp $" // // Clock widget for the Fast Light Tool Kit (FLTK). // @@ -136,17 +136,18 @@ Fl_Clock::Fl_Clock(uchar t, int x, int y, int w, int h, const char *l) box(t==FL_ROUND_CLOCK ? FL_NO_BOX : FL_UP_BOX); } -#ifndef WIN32 -#include -#endif - static void tick(void *v) { +#ifdef WIN32 + ((Fl_Clock*)v)->value(time(0)); + Fl::add_timeout(1.0, tick, v); +#else struct timeval t; gettimeofday(&t, NULL); ((Fl_Clock*)v)->value(t.tv_sec); double delay = 1.0-t.tv_usec*.000001; if (delay < .1 || delay > .9) delay = 1.0; Fl::add_timeout(delay, tick, v); +#endif } int Fl_Clock::handle(int event) { @@ -166,5 +167,5 @@ Fl_Clock::~Fl_Clock() { } // -// End of "$Id: Fl_Clock.cxx,v 1.5 1999/01/13 15:45:49 mike Exp $". +// End of "$Id: Fl_Clock.cxx,v 1.6 1999/01/13 15:58:33 mike Exp $". //