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