Tempo
Tempo is an app that allows users to create and manage timers, stopwatches, and alarms.
Timer.hpp
Go to the documentation of this file.
1 #ifndef TIMER_HPP
2 #define TIMER_HPP
3 
4 #include <chrono>
5 #include <iostream>
6 
7 using namespace std;
8 
12 class Timer
13 {
14 public:
24  Timer(int hours, int minutes, int seconds);
25 
31  void start(int countdownMilliseconds);
32 
36  void pause();
37 
41  void resume();
42 
46  void reset();
47 
55  void addTime(int seconds);
56 
62  bool isRunning();
63 
64  bool isDone();
65 
73  int remainingMilliseconds();
74 
80  double percentElapsed();
81 
82 private:
87 
88  bool _running;
89 
90  chrono::time_point<chrono::steady_clock> _endTime;
91  chrono::time_point<chrono::steady_clock> _pauseTime;
92 };
93 
94 #endif // TIMER_HPP
int _countdownMilliseconds
The duration of the countdown in milliseconds.
Definition: Timer.hpp:84
The Timer class provides a countdown timer with start, pause, resume, reset, and time adjustment func...
Definition: Timer.hpp:12
STL namespace.
int _startMilliseconds
The initial duration of the timer in milliseconds.
Definition: Timer.hpp:83
bool _running
Indicates whether the timer is currently running.
Definition: Timer.hpp:88
int _remainingMilliseconds
The remaining time in milliseconds.
Definition: Timer.hpp:85
chrono::time_point< chrono::steady_clock > _pauseTime
The time point when the timer was paused.
Definition: Timer.hpp:91
chrono::time_point< chrono::steady_clock > _endTime
The time point when the timer will end.
Definition: Timer.hpp:90
int _incrementMilliseconds
The increment time in milliseconds for adding time.
Definition: Timer.hpp:86