![]() |
Tempo
Tempo is an app that allows users to create and manage timers, stopwatches, and alarms.
|
The Timer class provides a countdown timer with start, pause, resume, reset, and time adjustment functionalities. More...
#include <Timer.hpp>

Public Member Functions | |
| Timer (int hours, int minutes, int seconds) | |
| Constructor to specify the timer duration directly in hours, minutes, and seconds. More... | |
| void | start (int countdownMilliseconds) |
| Starts the timer by setting the end time based on the current time plus the countdown duration. More... | |
| void | pause () |
| Pauses the timer and calculates the remaining milliseconds. More... | |
| void | resume () |
| Resumes the timer from where it was paused by recalculating the end time. More... | |
| void | reset () |
| Resets the timer to its original duration and pauses it. More... | |
| void | addTime (int seconds) |
| Adds a specified amount of time (in seconds) to the timer. More... | |
| bool | isRunning () |
| Checks if the timer is currently running. More... | |
| bool | isDone () |
| int | remainingMilliseconds () |
| Returns the remaining time in milliseconds. More... | |
| double | percentElapsed () |
| Returns the percentage of time that has elapsed since the timer started. More... | |
Private Attributes | |
| int | _startMilliseconds |
| The initial duration of the timer in milliseconds. More... | |
| int | _countdownMilliseconds |
| The duration of the countdown in milliseconds. More... | |
| int | _remainingMilliseconds |
| The remaining time in milliseconds. More... | |
| int | _incrementMilliseconds |
| The increment time in milliseconds for adding time. More... | |
| bool | _running |
| Indicates whether the timer is currently running. More... | |
| chrono::time_point< chrono::steady_clock > | _endTime |
| The time point when the timer will end. More... | |
| chrono::time_point< chrono::steady_clock > | _pauseTime |
| The time point when the timer was paused. More... | |
The Timer class provides a countdown timer with start, pause, resume, reset, and time adjustment functionalities.
| Timer::Timer | ( | int | hours, |
| int | minutes, | ||
| int | seconds | ||
| ) |
Constructor to specify the timer duration directly in hours, minutes, and seconds.
Initializes and starts the timer with the specified duration.
| hours | The number of hours to set. |
| minutes | The number of minutes to set. |
| seconds | The number of seconds to set. |
Definition at line 19 of file Timer.cpp.
| void Timer::addTime | ( | int | seconds | ) |
Adds a specified amount of time (in seconds) to the timer.
If the timer is running, it resumes after adding time.
| seconds | The number of seconds to add to the timer. |
Definition at line 95 of file Timer.cpp.
| bool Timer::isDone | ( | ) |
Definition at line 147 of file Timer.cpp.
Referenced by Display::tickTimer().

| bool Timer::isRunning | ( | ) |
Checks if the timer is currently running.
Definition at line 143 of file Timer.cpp.
Referenced by Menu::checkTimerInput(), and Display::tickTimer().

| void Timer::pause | ( | ) |
Pauses the timer and calculates the remaining milliseconds.
Definition at line 50 of file Timer.cpp.
Referenced by Menu::checkTimerInput().

| double Timer::percentElapsed | ( | ) |
Returns the percentage of time that has elapsed since the timer started.
Definition at line 160 of file Timer.cpp.
Referenced by Display::tickTimer().

| int Timer::remainingMilliseconds | ( | ) |
Returns the remaining time in milliseconds.
If the timer has expired, it returns 0.
Definition at line 118 of file Timer.cpp.
Referenced by Menu::checkTimerInput(), Display::tickTimer(), and Menu::timerSequence().

| void Timer::reset | ( | ) |
Resets the timer to its original duration and pauses it.
Definition at line 78 of file Timer.cpp.
Referenced by Menu::checkTimerInput().

| void Timer::resume | ( | ) |
Resumes the timer from where it was paused by recalculating the end time.
Definition at line 65 of file Timer.cpp.
Referenced by Menu::checkTimerInput().

| void Timer::start | ( | int | countdownMilliseconds | ) |
Starts the timer by setting the end time based on the current time plus the countdown duration.
| countdownMilliseconds | The duration for the countdown in milliseconds. |
Definition at line 38 of file Timer.cpp.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
1.8.13