Browse Source

cleaned up namespace in timing

master
Pete McNeil 4 years ago
parent
commit
bb411702d8
2 changed files with 10 additions and 13 deletions
  1. 6
    6
      timing.cpp
  2. 4
    7
      timing.hpp

+ 6
- 6
timing.cpp View File

@@ -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

+ 4
- 7
timing.hpp View File

@@ -51,12 +51,9 @@
// bits and pieces. This module will provide classes that abstract
// timing functions for use in GNU projects on *nix and win32 systems.

#ifndef MNR_timing
#define MNR_timing
#pragma once

// Introduce the standard namespace ///////////////////////////////////////////

using namespace std;
namespace codedweller {

///////////////////////////////////////////////////////////////////////////////
// class Sleeper - An object that remembers how long it is supposed to sleep.
@@ -206,7 +203,7 @@ class Timer {

private:

bool RunningFlag; // True if clock is running.
bool RunningFlag; // True if clock is running.
msclock StartTime; // TimeOfDay at start.
msclock StopTime; // TimeOfDay at stop or check.

@@ -357,4 +354,4 @@ class Timeout {
** Returns true if time is up.
*/

#endif // End MNR_timing once-only switch.
} // End namespace codedweller

Loading…
Cancel
Save