Torc  0.1
torctime.h
Go to the documentation of this file.
1 #ifndef TORCTIME_H
2 #define TORCTIME_H
3 
4 // Qt
5 #include <QObject>
6 #include <QTimer>
7 #include <QReadWriteLock>
8 
9 // Torc
10 #include "http/torchttpservice.h"
11 
12 class TorcTime : public QObject, public TorcHTTPService
13 {
14  friend class TorcTimeObject;
15 
16  Q_OBJECT
17 
18  Q_CLASSINFO("Version", "1.0.0")
19  Q_PROPERTY(QString currentTime READ GetCurrentTime NOTIFY currentTimeChanged)
20 
21  public:
22  virtual ~TorcTime() = default;
23 
24  protected:
25  explicit TorcTime();
26 
27  signals:
28  void currentTimeChanged (QString &Time);
29 
30  public slots:
31  // TorcHTTPService requirement
32  void SubscriberDeleted (QObject *Subscriber);
33  // internal timer
34  void Tick (void);
35  // Actual public slot
36  QString GetCurrentTime (void);
37  QString GetCurrentTimeUTC (void);
38 
39  private:
40  QString currentTime; // dummy
41  QDateTime m_lastTime;
42  QTimer m_timer;
43  QString m_dateTimeFormat;
44 };
45 
46 #endif // TORCTIME_H
void currentTimeChanged(QString &Time)
QString GetCurrentTimeUTC(void)
Definition: torctime.cpp:57
QString currentTime
Definition: torctime.h:19
void SubscriberDeleted(QObject *Subscriber)
Definition: torctime.cpp:82
A static class used to create the TorcTime singleton in the admin thread.
Definition: torctime.cpp:90
QString GetCurrentTime(void)
Definition: torctime.cpp:51
void Tick(void)
Definition: torctime.cpp:63
A simple time service to confirm the time (and date) the system is currently operating with...
Definition: torctime.h:12