19a1e991dSShuo Chen// excerpts from http://code.google.com/p/muduo/ 29a1e991dSShuo Chen// 39a1e991dSShuo Chen// Use of this source code is governed by a BSD-style license 49a1e991dSShuo Chen// that can be found in the License file. 59a1e991dSShuo Chen// 69a1e991dSShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com) 79a1e991dSShuo Chen 89a1e991dSShuo Chen#include "Timer.h" 99a1e991dSShuo Chen 109a1e991dSShuo Chenusing namespace muduo; 119a1e991dSShuo Chen 129a1e991dSShuo Chenvoid Timer::restart(Timestamp now) 139a1e991dSShuo Chen{ 149a1e991dSShuo Chen if (repeat_) 159a1e991dSShuo Chen { 169a1e991dSShuo Chen expiration_ = addTime(now, interval_); 179a1e991dSShuo Chen } 189a1e991dSShuo Chen else 199a1e991dSShuo Chen { 209a1e991dSShuo Chen expiration_ = Timestamp::invalid(); 219a1e991dSShuo Chen } 229a1e991dSShuo Chen} 23