1f4e8e3d3SShuo Chen // excerpts from http://code.google.com/p/muduo/ 2f4e8e3d3SShuo Chen // 3f4e8e3d3SShuo Chen // Use of this source code is governed by a BSD-style license 4f4e8e3d3SShuo Chen // that can be found in the License file. 5f4e8e3d3SShuo Chen // 6f4e8e3d3SShuo Chen // Author: Shuo Chen (chenshuo at chenshuo dot com) 7f4e8e3d3SShuo Chen 8f4e8e3d3SShuo Chen #include "Timer.h" 9f4e8e3d3SShuo Chen 10f4e8e3d3SShuo Chen using namespace muduo; 11f4e8e3d3SShuo Chen 12f4e8e3d3SShuo Chen+AtomicInt64 Timer::s_numCreated_; 13f4e8e3d3SShuo Chen+ 14f4e8e3d3SShuo Chen void Timer::restart(Timestamp now) 15f4e8e3d3SShuo Chen { 16f4e8e3d3SShuo Chen if (repeat_) 17f4e8e3d3SShuo Chen { 18f4e8e3d3SShuo Chen expiration_ = addTime(now, interval_); 19f4e8e3d3SShuo Chen } 20f4e8e3d3SShuo Chen else 21f4e8e3d3SShuo Chen { 22f4e8e3d3SShuo Chen expiration_ = Timestamp::invalid(); 23f4e8e3d3SShuo Chen } 24f4e8e3d3SShuo Chen } 25