|
|
@@ -33,9 +33,7 @@ |
|
|
|
|
|
|
|
#include "timing.hpp" |
|
|
|
|
|
|
|
// Introduce the standard namespace //////////////////////////////////////////// |
|
|
|
|
|
|
|
using namespace std; |
|
|
|
namespace codedweller { |
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////// |
|
|
|
// class Sleeper - An object that remembers how long it is supposed to sleep. |
|
|
@@ -92,7 +90,7 @@ int Sleeper::setMillisecondsToSleep(int x) { |
|
|
|
if(x < MinimumSleeperTime || |
|
|
|
x > MaximumSleeperTime) // If it's not a good time value |
|
|
|
throw BadSleeperValue(); // then throw the exception. |
|
|
|
MillisecondsToSleep = x; // If it is good - set it.
|
|
|
|
MillisecondsToSleep = x; // If it is good - set it. |
|
|
|
return MillisecondsToSleep; // Return the set value. |
|
|
|
} |
|
|
|
|
|
|
@@ -129,8 +127,8 @@ void Sleeper::operator()() { |
|
|
|
// a natural spiral. |
|
|
|
/////////////////////////////////////////////////////////////////////////////// |
|
|
|
|
|
|
|
PollTimer::PollTimer(int Nom, int Max) :
|
|
|
|
NominalPollTime(MinimumSleeperTime),
|
|
|
|
PollTimer::PollTimer(int Nom, int Max) : |
|
|
|
NominalPollTime(MinimumSleeperTime), |
|
|
|
MaximumPollTime(MinimumSleeperTime) { // Construction requires a |
|
|
|
setNominalPollTime(Nom); // nominal delay to use and |
|
|
|
setMaximumPollTime(Max); // a maximum delay to allow. |
|
|
@@ -326,3 +324,5 @@ msclock Timeout::getRemainingTime() { |
|
|
|
bool Timeout::isExpired() { // Return true if time is up. |
|
|
|
return (!(myTimer.getElapsedTime() < myDuration)); // Check the elapsed time against myDuration. |
|
|
|
} |
|
|
|
|
|
|
|
} // End namespace codedweller |