From 7189812021be8d0b9cd3d438635aea681ca95abf Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 26 Mar 2006 13:49:30 +0000 Subject: [PATCH] Portability --- timers.cc | 10 +++++----- timers.h | 4 ++-- vchannelselect.cc | 2 +- vlivebanner.cc | 8 ++++---- vmute.cc | 2 +- vtimerlist.cc | 2 +- vvideorec.cc | 6 +++--- vvolume.cc | 2 +- vwelcome.cc | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/timers.cc b/timers.cc index 26624b0..5452240 100755 --- a/timers.cc +++ b/timers.cc @@ -80,7 +80,7 @@ int Timers::shutdown() return 1; } -int Timers::setTimer(TimerReceiver* client, int clientReference, long int requestedTime, long int requestedTimeNSEC) +int Timers::setTimerT(TimerReceiver* client, int clientReference, long int requestedTime, long int requestedTimeNSEC) { if (!initted) return 0; @@ -127,7 +127,7 @@ int Timers::setTimer(TimerReceiver* client, int clientReference, long int reques return 1; } -int Timers::setTimer(TimerReceiver* client, int clientReference, struct timespec duration) +int Timers::setTimerD(TimerReceiver* client, int clientReference, long int requestedSecs, long int requestedNSecs) { struct timespec currentTime; clock_gettime(CLOCK_REALTIME, ¤tTime); @@ -135,8 +135,8 @@ int Timers::setTimer(TimerReceiver* client, int clientReference, struct timespec long int requestedTime; long int requestedTimeNSEC; - requestedTime = currentTime.tv_sec + duration.tv_sec; - requestedTimeNSEC = currentTime.tv_nsec + duration.tv_nsec; + requestedTime = currentTime.tv_sec + requestedSecs; + requestedTimeNSEC = currentTime.tv_nsec + requestedNSecs; if (requestedTimeNSEC > 999999999) { ++requestedTime; @@ -144,7 +144,7 @@ int Timers::setTimer(TimerReceiver* client, int clientReference, struct timespec logger->log("Timers", Log::DEBUG, "Second rollover - CHECK FIXME"); } - return setTimer(client, clientReference, requestedTime, requestedTimeNSEC); + return setTimerT(client, clientReference, requestedTime, requestedTimeNSEC); } int Timers::cancelTimer(TimerReceiver* client, int clientReference) diff --git a/timers.h b/timers.h index 562f00c..0aac2e7 100755 --- a/timers.h +++ b/timers.h @@ -74,8 +74,8 @@ class Timers : public Thread int init(); int shutdown(); - int setTimer(TimerReceiver* client, int clientReference, long int requestedTime, long int requestedTimeNSEC=0); - int setTimer(TimerReceiver* client, int clientReference, timespec duration); + int setTimerT(TimerReceiver* client, int clientReference, long int requestedTime, long int requestedTimeNSEC=0); + int setTimerD(TimerReceiver* client, int clientReference, long int requestedSecs, long int requestedNSecs=0); int cancelTimer(TimerReceiver* client, int clientReference); // Thread stuff diff --git a/vchannelselect.cc b/vchannelselect.cc index 02ed78d..8a48f05 100644 --- a/vchannelselect.cc +++ b/vchannelselect.cc @@ -123,7 +123,7 @@ void VChannelSelect::draw() } } - Timers::getInstance()->setTimer(this, 1, (struct timespec){3, 0}); + Timers::getInstance()->setTimerD(this, 1, 3); } int VChannelSelect::handleCommand(int command) diff --git a/vlivebanner.cc b/vlivebanner.cc index 703a070..afb411d 100644 --- a/vlivebanner.cc +++ b/vlivebanner.cc @@ -125,7 +125,7 @@ void VLiveBanner::setChannel(Channel* tChannel) } // Reset the timer as it probably took 1-2 seconds to change the channel - Timers::getInstance()->setTimer(this, 1, (struct timespec){4, 0}); + Timers::getInstance()->setTimerD(this, 1, 4); } void VLiveBanner::draw() @@ -165,7 +165,7 @@ int VLiveBanner::handleCommand(int command) ViewMan::getInstance()->updateView(this); // Arrows pressed, go to an 8s timer - Timers::getInstance()->setTimer(this, 1, (struct timespec){8, 0}); + Timers::getInstance()->setTimerD(this, 1, 8); return 2; } @@ -181,7 +181,7 @@ int VLiveBanner::handleCommand(int command) ViewMan::getInstance()->updateView(this); // Arrows pressed, go to an 8s timer - Timers::getInstance()->setTimer(this, 1, (struct timespec){8, 0}); + Timers::getInstance()->setTimerD(this, 1, 8); return 2; } @@ -293,5 +293,5 @@ void VLiveBanner::drawClock() dt += t; // get a time_t value for it rather than using duration // (so it will occur at the actual second and not second and a half) - Timers::getInstance()->setTimer(this, 2, dt); + Timers::getInstance()->setTimerT(this, 2, dt); } diff --git a/vmute.cc b/vmute.cc index 292914a..91643ea 100644 --- a/vmute.cc +++ b/vmute.cc @@ -54,7 +54,7 @@ void VMute::draw() w.setSurfaceOffset(5, 5); w.draw(); - Timers::getInstance()->setTimer(this, 1, (struct timespec){2, 0}); + Timers::getInstance()->setTimerD(this, 1, 2); } void VMute::timercall(int clientReference) diff --git a/vtimerlist.cc b/vtimerlist.cc index 69fea67..4d46d97 100644 --- a/vtimerlist.cc +++ b/vtimerlist.cc @@ -143,7 +143,7 @@ void VTimerList::drawClock() strftime(timeString, 19, "%d/%m %H:%M:%S", tms); drawTextRJ(timeString, 560, 5, Colour::LIGHTTEXT); - Timers::getInstance()->setTimer(this, 1, t + 1); + Timers::getInstance()->setTimerT(this, 1, t + 1); } void VTimerList::drawShowing() diff --git a/vvideorec.cc b/vvideorec.cc index dfcd34d..d437b3e 100644 --- a/vvideorec.cc +++ b/vvideorec.cc @@ -343,8 +343,8 @@ void VVideoRec::doBar(int action) drawBarClocks(); ViewMan::getInstance()->updateView(this, &barRegion); - timers->setTimer(this, 1, (struct timespec){4, 0}); - timers->setTimer(this, 2, (struct timespec){0, 200000000}); + timers->setTimerD(this, 1, 4); + timers->setTimerD(this, 2, 0, 200000000); } void VVideoRec::timercall(int clientReference) @@ -363,7 +363,7 @@ void VVideoRec::timercall(int clientReference) if (!barShowing) break; drawBarClocks(); ViewMan::getInstance()->updateView(this, &barRegion); - timers->setTimer(this, 2, (struct timespec){0, 200000000}); + timers->setTimerD(this, 2, 0, 200000000); break; } } diff --git a/vvolume.cc b/vvolume.cc index b423722..1c509cb 100644 --- a/vvolume.cc +++ b/vvolume.cc @@ -69,7 +69,7 @@ void VVolume::draw() w.draw(); } - Timers::getInstance()->setTimer(this, 1, (struct timespec){2, 0}); + Timers::getInstance()->setTimerD(this, 1, 2); } void VVolume::timercall(int clientReference) diff --git a/vwelcome.cc b/vwelcome.cc index fb3f849..fae90fc 100644 --- a/vwelcome.cc +++ b/vwelcome.cc @@ -106,7 +106,7 @@ void VWelcome::drawClock() dt += t; // get a time_t value for it rather than using duration // (so it will occur at the actual second and not second and a half) - Timers::getInstance()->setTimer(this, 1, dt); + Timers::getInstance()->setTimerT(this, 1, dt); } void VWelcome::timercall(int clientReference) -- 2.39.5