140161064SShuo Chen// excerpts from http://code.google.com/p/muduo/ 240161064SShuo Chen// 340161064SShuo Chen// Use of this source code is governed by a BSD-style license 440161064SShuo Chen// that can be found in the License file. 540161064SShuo Chen// 640161064SShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com) 740161064SShuo Chen 840161064SShuo Chen#include "Timer.h" 940161064SShuo Chen 1040161064SShuo Chenusing namespace muduo; 1140161064SShuo Chen 12f4e8e3d3SShuo ChenAtomicInt64 Timer::s_numCreated_; 13f4e8e3d3SShuo Chen 1440161064SShuo Chenvoid Timer::restart(Timestamp now) 1540161064SShuo Chen{ 1640161064SShuo Chen if (repeat_) 1740161064SShuo Chen { 1840161064SShuo Chen expiration_ = addTime(now, interval_); 1940161064SShuo Chen } 2040161064SShuo Chen else 2140161064SShuo Chen { 2240161064SShuo Chen expiration_ = Timestamp::invalid(); 2340161064SShuo Chen } 2440161064SShuo Chen} 25