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