Timer.cc revision 42bf2220
142bf2220SShuo Chen// excerpts from http://code.google.com/p/muduo/ 242bf2220SShuo Chen// 342bf2220SShuo Chen// Use of this source code is governed by a BSD-style license 442bf2220SShuo Chen// that can be found in the License file. 542bf2220SShuo Chen// 642bf2220SShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com) 742bf2220SShuo Chen 842bf2220SShuo Chen#include "Timer.h" 942bf2220SShuo Chen 1042bf2220SShuo Chenusing namespace muduo; 1142bf2220SShuo Chen 1242bf2220SShuo Chenvoid Timer::restart(Timestamp now) 1342bf2220SShuo Chen{ 1442bf2220SShuo Chen if (repeat_) 1542bf2220SShuo Chen { 1642bf2220SShuo Chen expiration_ = addTime(now, interval_); 1742bf2220SShuo Chen } 1842bf2220SShuo Chen else 1942bf2220SShuo Chen { 2042bf2220SShuo Chen expiration_ = Timestamp::invalid(); 2142bf2220SShuo Chen } 2242bf2220SShuo Chen} 23