uses std::chrono
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* A Timer Implementation
|
||||
* Nana C++ Library(http://www.nanapro.org)
|
||||
* Copyright(C) 2003-2018 Jinhao(cnjinhao@hotmail.com)
|
||||
* Copyright(C) 2003-2019 Jinhao(cnjinhao@hotmail.com)
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
@@ -174,6 +174,12 @@ namespace nana
|
||||
: impl_(new implement)
|
||||
{
|
||||
}
|
||||
|
||||
timer::timer(std::chrono::milliseconds ms):
|
||||
timer()
|
||||
{
|
||||
this->interval(ms);
|
||||
}
|
||||
|
||||
timer::~timer()
|
||||
{
|
||||
@@ -220,17 +226,17 @@ namespace nana
|
||||
timer_driver::instance().destroy(tmid);
|
||||
}
|
||||
|
||||
void timer::interval_(unsigned ms)
|
||||
void timer::interval(std::chrono::milliseconds ms)
|
||||
{
|
||||
if (ms != impl_->interval)
|
||||
if (ms.count() != static_cast<long long>(impl_->interval))
|
||||
{
|
||||
impl_->interval = ms;
|
||||
impl_->interval = static_cast<unsigned>(ms.count());
|
||||
if (impl_->tm_core)
|
||||
impl_->tm_core->interval(ms);
|
||||
impl_->tm_core->interval(impl_->interval);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned timer::interval() const
|
||||
unsigned timer::_m_interval() const
|
||||
{
|
||||
return impl_->interval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user