-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterval.cpp
More file actions
49 lines (39 loc) · 759 Bytes
/
Interval.cpp
File metadata and controls
49 lines (39 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "Interval.hpp"
Interval::Interval( void ) : _initial(std::clock())
{
return ;
}
Interval::Interval(Interval const & src)
{
*this = src;
return ;
}
Interval::~Interval( void )
{
return ;
}
Interval & Interval::operator=(Interval const & rhs)
{
this->_initial = rhs._initial;
return *this;
}
std::string Interval::toString() const
{
std::ostringstream ostr;
ostr << "Interval : Initial Value " << this->_initial << " Current Value " <<
this->value() << std::endl;
return ostr.str();
}
void Interval::refresh()
{
this->_initial = std::clock();
}
unsigned int Interval::value() const
{
return std::clock() - this->_initial;
}
std::ostream & operator<<(std::ostream & o, Interval const & rhs)
{
o << rhs.toString();
return o;
}