Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
Sleeper Class Reference

#include <test-helpers.hh>

Collaboration diagram for Sleeper:
Collaboration graph

Public Member Functions

 Sleeper (unsigned int secs)
 
bool operator() ()
 

Private Attributes

unsigned int secs
 
bool started {false}
 
struct timespec t = {0, 0}
 

Constructor & Destructor Documentation

◆ Sleeper()

Sleeper::Sleeper ( unsigned int  secs)
explicit
98 : secs(secs_)
99{
100}
unsigned int secs
Definition test-helpers.hh:92

Member Function Documentation

◆ operator()()

bool Sleeper::operator() ( )
103{
104 if(!started && 0 == clock_gettime(CLOCK_REALTIME, &t))
105 {
106 started = true;
107 return true;
108 }
109
110 struct timespec now = {0, 0};
111 if(0 == clock_gettime(CLOCK_REALTIME, &now))
112 {
113 if(now.tv_sec > t.tv_sec + secs)
114 {
115 return false;
116 }
117 }
118
119 return true;
120}
bool started
Definition test-helpers.hh:93
struct timespec t
Definition test-helpers.hh:94

Member Data Documentation

◆ secs

unsigned int Sleeper::secs
private

Referenced by operator()().

◆ started

bool Sleeper::started {false}
private
93{false};

Referenced by operator()().

◆ t

struct timespec Sleeper::t = {0, 0}
private
94{0, 0};

Referenced by operator()().


The documentation for this class was generated from the following files: