time: use floats for seconds
This commit is contained in:
parent
6eb2badaef
commit
803ec2cacc
8
time.cpp
8
time.cpp
@ -79,21 +79,21 @@ util::sleep (uint64_t ns) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
delta_clock::delta_clock():
|
delta_clock::delta_clock ():
|
||||||
time { util::nanoseconds (), util::nanoseconds () }
|
time { util::nanoseconds (), util::nanoseconds () }
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
double
|
float
|
||||||
delta_clock::seconds (void) {
|
delta_clock::seconds (void) {
|
||||||
time.prev = time.curr;
|
time.prev = time.curr;
|
||||||
time.curr = nanoseconds ();
|
time.curr = nanoseconds ();
|
||||||
|
|
||||||
return (time.curr - time.prev) / static_cast<double> (SECOND);
|
return (time.curr - time.prev) / static_cast<float> (SECOND);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
util::period_query::period_query (double seconds) {
|
util::period_query::period_query (float seconds) {
|
||||||
m_time.start = nanoseconds ();
|
m_time.start = nanoseconds ();
|
||||||
m_time.period = static_cast<uint64_t> (seconds * SECOND);
|
m_time.period = static_cast<uint64_t> (seconds * SECOND);
|
||||||
}
|
}
|
||||||
|
4
time.hpp
4
time.hpp
@ -34,7 +34,7 @@ namespace util {
|
|||||||
class delta_clock {
|
class delta_clock {
|
||||||
public:
|
public:
|
||||||
delta_clock ();
|
delta_clock ();
|
||||||
double seconds (void);
|
float seconds (void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct {
|
struct {
|
||||||
@ -46,7 +46,7 @@ namespace util {
|
|||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
class period_query {
|
class period_query {
|
||||||
public:
|
public:
|
||||||
period_query (double seconds);
|
period_query (float seconds);
|
||||||
|
|
||||||
bool poll (void);
|
bool poll (void);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user