resonance 1.0.1
Loading...
Searching...
No Matches
timeclock.h
Go to the documentation of this file.
1#pragma once
2
3#include "sch/time.h"
4
5namespace Sch {
6
7class CmdID;
8class Command;
9class Scheduler;
10
23class TimeClock {
24public:
30 TimeClock(Scheduler *pWatchdog);
31
41 void SetOrigin(long long nNanoseconds);
42
53 long long Now();
54
65 void Pause();
66
77 void Resume();
78
99 void Post(Sch::Command *pCommand, Sch::Time tick, CmdID &id, int bRecordable, int bDelta);
100
111 void Withdraw(const CmdID &id);
112
127 void PostIn(Sch::Command *pCommand, Sch::Time tick, CmdID &id, int bRecordable);
128
139 void PostIn(Sch::Command *pCommand, Sch::Time tick);
140
147 long long mNegatedOrigin;
148
154 long long mPausedNs;
155
158
165};
166
167} // namespace Sch
Handle that identifies one batch of commands the scheduler has queued.
Definition cmdid.h:35
Base of every action the scheduler performs on behalf of another subsystem.
Definition command.h:60
Scheduler that runs queued commands when their due time arrives.
Definition scheduler.h:45
Scheduler * mWatchdog
The scheduler whose current time the readings follow.
Definition timeclock.h:164
long long mPausedNs
The reading Now() reports while no origin is set, in nanoseconds.
Definition timeclock.h:154
void SetOrigin(long long nNanoseconds)
Fix the origin of the time base.
long long Now()
Report the current time.
TimeClock(Scheduler *pWatchdog)
void Withdraw(const CmdID &id)
Withdraw the first wrapper queued under a handle.
int mHasOrigin
Non-zero while the time base runs against the scheduler.
Definition timeclock.h:157
void Pause()
Stop the time base at its current reading.
long long mNegatedOrigin
The origin, negated, in nanoseconds.
Definition timeclock.h:147
void PostIn(Sch::Command *pCommand, Sch::Time tick)
Queue a command a distance from now, discarding the handle.
void Post(Sch::Command *pCommand, Sch::Time tick, CmdID &id, int bRecordable, int bDelta)
Queue a command, choosing between the absolute and the delta path.
void Resume()
Restart the time base from the reading Pause() stopped it at.
void PostIn(Sch::Command *pCommand, Sch::Time tick, CmdID &id, int bRecordable)
Queue a command a distance from now, under a handle the caller retains.
Scheduler time, as a signed 64-bit count.
Definition time.h:44
Scheduling of timed commands.
Definition activefilter.h:9