Nebula
Loading...
Searching...
No Matches
posixtimer.h
Go to the documentation of this file.
1#pragma once
2#ifndef POSIX_POSIXTIMER_H
3#define POSIX_POSIXTIMER_H
4//------------------------------------------------------------------------------
19#include "core/types.h"
20#include "timing/time.h"
21
22//------------------------------------------------------------------------------
23namespace Posix
24{
26{
27public:
29 PosixTimer();
31 void Start();
33 void Stop();
35 void Reset();
37 bool Running() const;
39 Timing::Time GetTime() const;
41 Timing::Tick GetTicks() const;
42
43private:
46
47 Timing::Time ToTime(const timespec & ts) const;
48
49 bool running;
50 Timing::Time diffTime; // accumulated time when the timer was not running
51 Timing::Time stopTime; // when was the timer last stopped?
52};
53
54} // namespace Posix
55//------------------------------------------------------------------------------
56#endif
57
Posix implementation of the Time::Timer class.
Definition posixtimer.h:26
Timing::Time diffTime
Definition posixtimer.h:50
void Start()
start/continue the timer
Definition posixtimer.cc:31
Timing::Time GetTime() const
get current time in seconds
Definition posixtimer.cc:136
Timing::Tick GetTicks() const
get current time in ticks
Definition posixtimer.cc:147
bool Running() const
return true if currently running
Definition posixtimer.cc:88
bool running
Definition posixtimer.h:49
void Reset()
reset the timer
Definition posixtimer.cc:68
PosixTimer()
constructor
Definition posixtimer.cc:16
void Stop()
stop the timer
Definition posixtimer.cc:56
Timing::Time InternalTime() const
return internal time
Definition posixtimer.cc:108
Timing::Time ToTime(const timespec &ts) const
Convert timespec to Timing::Time.
Definition posixtimer.cc:98
Timing::Time stopTime
Definition posixtimer.h:51
Posix implemention of a read-many write-few lock.
Definition posixsysfunc.cc:21
int Tick
the tick datatype (one tick == 1 millisecond)
Definition time.h:20
double Time
the time datatype
Definition time.h:18
Typedefs for the Timing subsystem.