Root/
| 1 | #ifndef __CLOCK_H__ |
| 2 | #define __CLOCK_H__ |
| 3 | |
| 4 | #include <memory> |
| 5 | #include <string> |
| 6 | |
| 7 | |
| 8 | /** |
| 9 | * A keeper of wall clock time with minute accuracy. |
| 10 | * Sends a user event on every minute boundary, to force a repaint of the |
| 11 | * clock display. |
| 12 | */ |
| 13 | class Clock { |
| 14 | public: |
| 15 | /** |
| 16 | * Used by implementation; please ignore. |
| 17 | */ |
| 18 | class Timer; |
| 19 | |
| 20 | Clock(); |
| 21 | |
| 22 | /** |
| 23 | * Gets a string representation of the current time. |
| 24 | * Uses 24-hour format if is24 is true, otherwise AM/PM. |
| 25 | */ |
| 26 | std::string getTime(bool is24 = true); |
| 27 | |
| 28 | private: |
| 29 | std::shared_ptr<Timer> timer; |
| 30 | }; |
| 31 | |
| 32 | #endif /* __CLOCK_H__ */ |
| 33 |
Branches:
install_locations
master
opkrun
packages
