--- nono/vm/event.h 2026/04/29 17:04:44 1.1.1.6 +++ nono/vm/event.h 2026/04/29 17:04:55 1.1.1.8 @@ -12,41 +12,41 @@ // ユーザ定義リテラルを使ったサフィックス // ナノ秒 -static inline uint64 operator"" _nsec(unsigned long long ns) +static inline constexpr uint64 operator"" _nsec(unsigned long long ns) { return ns; } -static inline uint64 operator"" _nsec(long double ns) +static inline constexpr uint64 operator"" _nsec(long double ns) { return ns; } // マイクロ秒 -static inline uint64 operator"" _usec(unsigned long long us) +static inline constexpr uint64 operator"" _usec(unsigned long long us) { return us * 1000_nsec; } -static inline uint64 operator"" _usec(long double us) +static inline constexpr uint64 operator"" _usec(long double us) { return us * 1000_nsec; } // ミリ秒 -static inline uint64 operator"" _msec(unsigned long long ms) +static inline constexpr uint64 operator"" _msec(unsigned long long ms) { return ms * 1000_usec; } -static inline uint64 operator"" _msec(long double ms) +static inline constexpr uint64 operator"" _msec(long double ms) { return ms * 1000_usec; } // 秒 -static inline uint64 operator"" _sec(unsigned long long sec) +static inline constexpr uint64 operator"" _sec(unsigned long long sec) { return sec * 1000_msec; } -static inline uint64 operator"" _sec(long double sec) +static inline constexpr uint64 operator"" _sec(long double sec) { return sec * 1000_msec; } @@ -66,6 +66,7 @@ class Event { public: Event(); + Event(Device *dev_); virtual ~Event(); // このイベントタイマーを開始する @@ -73,6 +74,11 @@ class Event // このイベントタイマーを停止する void Stop(); + // このイベントが動作中なら true を返す + bool IsRunning() const { + return active; + } + // 以下はイベントを呼び出す側がセットする // イベントを起こすまでの仮想時刻での相対時間 [nsec]