MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / Timer

Class Timer

source/core/StarTime.hpp:82–107  ·  view source on GitHub ↗

An instance of Clock that counts down a given amount of time

Source from the content-addressed store, hash-verified

80
81// An instance of Clock that counts down a given amount of time
82class Timer : private Clock {
83public:
84 static Timer withTime(double timeLeft, bool start = true);
85 static Timer withMilliseconds(int64_t millis, bool start = true);
86
87 // Constructs a stopped timer whose time is up.
88 Timer();
89 Timer(Timer const& timer);
90 Timer& operator=(Timer const& timer);
91
92 // Start the timer with the given time left.
93 void restart(double timeLeft);
94 void restartWithMilliseconds(int64_t millisecondsLeft);
95
96 // Time remaining on the timer. If negative is true, will return negative
97 // time values after the timer is up, if false it stops at zero.
98 double timeLeft(bool negative = false) const;
99 int64_t millisecondsLeft(bool negative = false) const;
100
101 // Is the time remaining <= 0.0?
102 bool timeUp() const;
103
104 using Clock::stop;
105 using Clock::start;
106 using Clock::running;
107};
108
109}

Callers 2

signalRegionMethod · 0.50
signalSystemMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected