aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/source/fltimer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/flext/source/fltimer.cpp')
-rwxr-xr-xexternals/grill/flext/source/fltimer.cpp52
1 files changed, 12 insertions, 40 deletions
diff --git a/externals/grill/flext/source/fltimer.cpp b/externals/grill/flext/source/fltimer.cpp
index d9bf3cc1..6f13999f 100755
--- a/externals/grill/flext/source/fltimer.cpp
+++ b/externals/grill/flext/source/fltimer.cpp
@@ -25,31 +25,6 @@ WARRANTIES, see the file, "license.txt," in this distribution.
#endif
-
-double flext::GetTime()
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- return clock_gettimesince(0)*0.001;
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- double tm;
- clock_getftime(&tm);
- return tm*0.001;
-#else
- #error Not implemented
-#endif
-}
-
-double flext::GetTimeGrain()
-{
-#if FLEXT_SYS == FLEXT_SYS_PD
- return 0;
-#elif FLEXT_SYS == FLEXT_SYS_MAX
- return 0.001;
-#else
- #error Not implemented
-#endif
-}
-
#if FLEXT_OS == FLEXT_OS_WIN
static double perffrq = 0;
#endif
@@ -246,9 +221,9 @@ bool flext::Timer::Delay(double tm,void *data)
bool flext::Timer::Periodic(double tm,void *data)
{
userdata = data;
- period = tm;
+ period = tm;
#if FLEXT_SYS == FLEXT_SYS_PD
- clock_delay(clk,tm*1000);
+ clock_delay(clk,tm*1000.);
#elif FLEXT_SYS == FLEXT_SYS_MAX
clock_fdelay(clk,tm*1000.);
#else
@@ -257,29 +232,26 @@ bool flext::Timer::Periodic(double tm,void *data)
return true;
}
-/*! \brief Callback function for system clock.
- \todo Make periodic events scheduled as such.
-*/
+//! \brief Callback function for system clock.
void flext::Timer::callback(Timer *tmr)
{
+#if FLEXT_SYS == FLEXT_SYS_MAX
+ if(tmr->queued)
+ qelem_set(tmr->qelem);
+ else
+#endif
+ tmr->Work();
+
if(tmr->period) {
- // clearly it would be more precise if the periodic event is scheduled as such
- // and not retriggered every time
+ // reschedule
#if FLEXT_SYS == FLEXT_SYS_PD
- clock_delay(tmr->clk,tmr->period*1000);
+ clock_delay(tmr->clk,tmr->period*1000.);
#elif FLEXT_SYS == FLEXT_SYS_MAX
clock_fdelay(tmr->clk,tmr->period*1000.);
#else
#error Not implemented
#endif
}
-
-#if FLEXT_SYS == FLEXT_SYS_MAX
- if(tmr->queued)
- qelem_set(tmr->qelem);
- else
-#endif
- tmr->Work();
}
#if FLEXT_SYS == FLEXT_SYS_MAX