Timer.cc revision 2745a763
12745a763SShuo Chen// excerpts from http://code.google.com/p/muduo/ 22745a763SShuo Chen// 32745a763SShuo Chen// Use of this source code is governed by a BSD-style license 42745a763SShuo Chen// that can be found in the License file. 52745a763SShuo Chen// 62745a763SShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com) 72745a763SShuo Chen 82745a763SShuo Chen#include "Timer.h" 92745a763SShuo Chen 102745a763SShuo Chenusing namespace muduo; 112745a763SShuo Chen 122745a763SShuo Chenvoid Timer::restart(Timestamp now) 132745a763SShuo Chen{ 142745a763SShuo Chen if (repeat_) 152745a763SShuo Chen { 162745a763SShuo Chen expiration_ = addTime(now, interval_); 172745a763SShuo Chen } 182745a763SShuo Chen else 192745a763SShuo Chen { 202745a763SShuo Chen expiration_ = Timestamp::invalid(); 212745a763SShuo Chen } 222745a763SShuo Chen} 23