diff --git a/include/nana/gui/timer.hpp b/include/nana/gui/timer.hpp index 169f0f76..32e3f2a5 100644 --- a/include/nana/gui/timer.hpp +++ b/include/nana/gui/timer.hpp @@ -38,7 +38,9 @@ namespace nana timer& operator=(timer&&) = delete; public: timer(); - timer(unsigned int ms) : timer{} { interval(ms); } /// Accepts an initial interval in ms + [[deprecated("prefer a std::chrono::duration (like std::chrono::milliseconds) over " + "raw integers for durations")]] + timer(unsigned int ms) : timer{} { interval_(ms); } /// Accepts an initial interval in ms template /// Accepts an initial interval in any chrono unit explicit timer(std::chrono::duration const & time) : timer{} { interval(time); } @@ -55,11 +57,13 @@ namespace nana bool started() const; void stop(); - void interval(unsigned milliseconds); ///< Set the duration between calls (millisec ??) + [[deprecated("prefer a std::chrono::duration (like std::chrono::milliseconds) over " + "raw integers for durations")]] + inline void interval(unsigned milliseconds) { interval_(milliseconds); } template inline void interval(std::chrono::duration const & time_interval) ///< Set the duration between calls, accepts std::chrono { - interval(std::chrono::duration_cast(time_interval).count()); + interval_(std::chrono::duration_cast(time_interval).count()); } unsigned interval() const; template @@ -67,6 +71,8 @@ namespace nana { return std::chrono::duration_cast(std::chrono::milliseconds(interval)); } + private: + void interval_(unsigned milliseconds); ///< Set the duration between calls (millisec ??) private: nana::basic_event elapse_; implement * const impl_; diff --git a/source/gui/timer.cpp b/source/gui/timer.cpp index b19a3b11..4fe9abf4 100644 --- a/source/gui/timer.cpp +++ b/source/gui/timer.cpp @@ -220,7 +220,7 @@ namespace nana timer_driver::instance().destroy(tmid); } - void timer::interval(unsigned ms) + void timer::interval_(unsigned ms) { if (ms != impl_->interval) {