2013-07-22 06:54:09 +03:00
|
|
|
#ifndef __CLOCK_H__
|
|
|
|
#define __CLOCK_H__
|
|
|
|
|
2013-08-09 04:13:02 +03:00
|
|
|
#include <memory>
|
2013-07-22 06:54:09 +03:00
|
|
|
#include <string>
|
|
|
|
|
2013-08-09 04:13:02 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A keeper of wall clock time with minute accuracy.
|
|
|
|
* Sends a user event on every minute boundary, to force a repaint of the
|
|
|
|
* clock display.
|
|
|
|
*/
|
2013-07-22 06:54:09 +03:00
|
|
|
class Clock {
|
|
|
|
public:
|
2013-08-09 04:13:02 +03:00
|
|
|
/**
|
|
|
|
* Used by implementation; please ignore.
|
|
|
|
*/
|
|
|
|
class Timer;
|
|
|
|
|
2013-08-06 22:55:31 +03:00
|
|
|
Clock();
|
2013-07-22 06:54:09 +03:00
|
|
|
|
2013-08-09 04:13:02 +03:00
|
|
|
/**
|
|
|
|
* Gets a string representation of the current time.
|
|
|
|
* Uses 24-hour format if is24 is true, otherwise AM/PM.
|
|
|
|
*/
|
2013-08-06 22:55:31 +03:00
|
|
|
std::string getTime(bool is24 = true);
|
|
|
|
|
2013-07-22 06:54:09 +03:00
|
|
|
private:
|
2013-08-09 04:13:02 +03:00
|
|
|
std::shared_ptr<Timer> timer;
|
2013-07-22 06:54:09 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __CLOCK_H__ */
|