--- nono/vm/rtc.h 2026/04/29 17:05:11 1.1.1.9 +++ nono/vm/rtc.h 2026/04/29 17:05:43 1.1.1.13 @@ -14,22 +14,20 @@ #include "event.h" #include -// これ自体が IODevice である必要はないが派生側が IODevice を必要とするため。 +class Syncer; + class RTCDevice : public IODevice { using inherited = IODevice; public: - RTCDevice(const std::string& objname_); - virtual ~RTCDevice() override; + RTCDevice(); + ~RTCDevice() override; bool Init() override; virtual void StartTime(); - // clock-sync が実時間同期なら true を返す - bool GetSyncRealtime() const { return sync_rt; } - // 電源 OFF 時の実時間でのクロック入力。 // 次回のクロック発生までの時間間隔を返す。 uint64 ClockIn_PowerOff(); @@ -122,7 +120,7 @@ class RTCDevice : public IODevice bool ParseTime(const std::string& str, int *h, int *m, int *s); // 現在の月の最終日を返す (月の繰り上がり処理用) - int GetLastMday() const; + uint GetLastMday() const; // イベントコールバック void Callback(Event& ev); @@ -133,8 +131,12 @@ class RTCDevice : public IODevice // システムクロックが刻んでいる時刻 uint64 stime {}; + Syncer *syncer {}; + // RTC クロック入力 Event event { this }; }; -extern RTCDevice *gRTC; +static inline RTCDevice *GetRTCDevice() { + return Object::GetObject(OBJ_RTC); +}