Tempo
Tempo is an app that allows users to create and manage timers, stopwatches, and alarms.
Alarm.hpp
Go to the documentation of this file.
1 #ifndef ALARM_HPP
2 #define ALARM_HPP
3 
4 #include <thread>
5 #include <ctime>
6 #include <iostream>
7 #include <iomanip>
8 #include <chrono>
9 #include <sstream>
10 
11 using namespace std;
12 
13 class Alarm {
14 public:
15 
16  Alarm(int h, int m);
17 
18  chrono::time_point<chrono::system_clock> getTime(int h, int m);
19  string timeToString(chrono::time_point<chrono::system_clock> t);
20 
21  chrono::time_point<chrono::system_clock> getStartTime();
22  chrono::time_point<chrono::system_clock> getEndTime();
23 
24  static chrono::time_point<chrono::system_clock> currentTime();
25 
26  void start();
27  bool isRunning();
28  bool isDone();
29 
30  int remainingMilliseconds();
31 
32 
33  double percentElapsed();
34 
35 private:
36 
38 
39  bool _running;
40 
41  chrono::time_point<chrono::system_clock> _startTime;
42  chrono::time_point<chrono::system_clock> _endTime;
43 
44 };
45 
46 #endif
A class to manage alarms with time-based triggers.
Definition: Alarm.hpp:13
STL namespace.
chrono::time_point< chrono::system_clock > _startTime
Definition: Alarm.hpp:41
bool _running
Definition: Alarm.hpp:39
chrono::time_point< chrono::system_clock > _endTime
Definition: Alarm.hpp:42
int _remainingMilliseconds
Definition: Alarm.hpp:37