Auxiliary class for time values.
More...
#include <JTimeval.hh>
Auxiliary class for time values.
This class encapsulates the timeval
data structure.
Definition at line 26 of file JTimeval.hh.
◆ JTimeval() [1/3]
JLANG::JTimeval::JTimeval |
( |
| ) |
|
|
inline |
◆ JTimeval() [2/3]
JLANG::JTimeval::JTimeval |
( |
const int |
tv_us | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 46 of file JTimeval.hh.
49 this->tv_usec = tv_us;
◆ JTimeval() [3/3]
JLANG::JTimeval::JTimeval |
( |
const int |
tv_s, |
|
|
const int |
tv_us |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
tv_s | time [s] |
tv_us | time [us] |
Definition at line 59 of file JTimeval.hh.
62 this->tv_usec = tv_us;
◆ getTimeval() [1/2]
const JTimeval& JLANG::JTimeval::getTimeval |
( |
| ) |
const |
|
inline |
Get time value.
- Returns
- time value
Definition at line 71 of file JTimeval.hh.
73 return static_cast<const JTimeval&>(*
this);
◆ getTimeval() [2/2]
JTimeval& JLANG::JTimeval::getTimeval |
( |
| ) |
|
|
inline |
Get time value.
- Returns
- time value
Definition at line 82 of file JTimeval.hh.
84 return static_cast<JTimeval&>(*
this);
◆ setTimeval()
void JLANG::JTimeval::setTimeval |
( |
const JTimeval & |
timeval | ) |
|
|
inline |
Set time value.
- Parameters
-
Definition at line 93 of file JTimeval.hh.
95 static_cast<JTimeval&>(*
this) = timeval;
◆ less()
bool JLANG::JTimeval::less |
( |
const JTimeval & |
value | ) |
const |
|
inline |
Less than method.
- Parameters
-
- Returns
- true if this time value less than given time value; else false
Definition at line 105 of file JTimeval.hh.
107 if (this->tv_sec == value.tv_sec)
108 return this->tv_usec < value.tv_usec;
110 return this->tv_sec < value.tv_sec;
◆ min()
static JTimeval JLANG::JTimeval::min |
( |
| ) |
|
|
inlinestatic |
Get minimal time value.
- Returns
- time value
Definition at line 119 of file JTimeval.hh.
◆ max()
static JTimeval JLANG::JTimeval::max |
( |
| ) |
|
|
inlinestatic |
Get maximal time value.
- Returns
- time value
Definition at line 131 of file JTimeval.hh.
133 return JTimeval(std::numeric_limits<int>::max(), std::numeric_limits<int>::max());
◆ get() [1/2]
const timeval* JLANG::JTimeval::get |
( |
| ) |
const |
|
inline |
Get pointer to time value.
- Returns
- pointer to time value
Definition at line 143 of file JTimeval.hh.
145 return static_cast<const timeval*>(
this);
◆ get() [2/2]
timeval* JLANG::JTimeval::get |
( |
| ) |
|
|
inline |
Get pointer to time value.
- Returns
- pointer to time value
Definition at line 154 of file JTimeval.hh.
156 return static_cast<timeval*>(
this);
◆ operator&() [1/2]
const timeval* JLANG::JTimeval::operator& |
( |
| ) |
const |
|
inline |
Address of operator.
- Returns
- pointer to time value
Definition at line 165 of file JTimeval.hh.
◆ operator&() [2/2]
timeval* JLANG::JTimeval::operator& |
( |
| ) |
|
|
inline |
Address of operator.
- Returns
- pointer to time value
Definition at line 176 of file JTimeval.hh.
◆ operator>>
std::istream& operator>> |
( |
std::istream & |
in, |
|
|
JTimeval & |
time |
|
) |
| |
|
friend |
Read time value from input.
- Parameters
-
in | input stream |
time | time value |
- Returns
- input stream
Definition at line 189 of file JTimeval.hh.
191 return in >> time.tv_sec >> time.tv_usec;
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const JTimeval & |
time |
|
) |
| |
|
friend |
Write time value to output.
- Parameters
-
out | output stream |
time | time value |
- Returns
- output stream
Definition at line 202 of file JTimeval.hh.
204 return out << time.tv_sec <<
' ' << time.tv_usec;
The documentation for this class was generated from the following file: