From 9dce38099a02a6ae2b3fde282f716aff0987a34d Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Thu, 22 Feb 2018 06:00:28 +0000 Subject: 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 --- src/forms_timer.cxx | 38 ++++++-------------------------------- 1 file 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 #include #include -#ifdef _WIN32 -# ifdef __MWERKS__ -# include -# else -# include -# include -# endif -#else -# include -# include -#endif +#include #include #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() { -- cgit v1.2.3