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