summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2018-02-22 06:00:28 +0000
committerManolo Gouy <Manolo>2018-02-22 06:00:28 +0000
commit9dce38099a02a6ae2b3fde282f716aff0987a34d (patch)
tree2d244ff459d75fcb397feae663b28f68c85715d7 /src
parent7aaaf59e159055695a31fc6bd2c118651430082b (diff)
Make forms_timer.cxx platform-independent calling virtual function Fl_System_Driver::gettime().
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12684 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/forms_timer.cxx38
1 files changed, 6 insertions, 32 deletions
diff --git a/src/forms_timer.cxx b/src/forms_timer.cxx
index c8782c7c3..cb343f33b 100644
--- a/src/forms_timer.cxx
+++ b/src/forms_timer.cxx
@@ -24,43 +24,17 @@
#include <FL/Fl_Timer.H>
#include <FL/fl_draw.H>
#include <FL/forms.H>
-#ifdef _WIN32
-# ifdef __MWERKS__
-# include <time.h>
-# else
-# include <sys/types.h>
-# include <sys/timeb.h>
-# endif
-#else
-# include <time.h>
-# include <sys/time.h>
-#endif
+#include <FL/Fl_System_Driver.H>
#include <stdio.h>
#define FL_TIMER_BLINKRATE 0.2
void fl_gettime(long* sec, long* usec) {
-#ifdef _WIN32
-# ifdef __MWERKS__
- time_t localTime = time(NULL);
- struct tm *now = localtime(&localTime);
- *sec = now->tm_sec + 60*now->tm_min + 3600*now->tm_hour + 24*3600*now->tm_yday;
- *usec = 0;
-# else
- struct timeb tp;
- ftime(&tp);
- *sec = (long) tp.time;
- *usec = tp.millitm * 1000;
-# endif
-#elif defined(FL_PORTING) && !defined(__APPLE__) // PORTME: platform timer
-# pragma message "FL_PORTING: implement time, rarely needed, if ever."
-#else
- struct timeval tp;
- struct timezone tzp;
- gettimeofday(&tp, &tzp);
- *sec = tp.tv_sec;
- *usec = tp.tv_usec;
-#endif
+ time_t tt_sec;
+ int i_usec;
+ Fl::system_driver()->gettime(&tt_sec, &i_usec);
+ *sec = (long)tt_sec;
+ *usec = i_usec;
}
void Fl_Timer::draw() {