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