Timer.cc revision 65c497a3
165c497a3SShuo Chen// excerpts from http://code.google.com/p/muduo/ 265c497a3SShuo Chen// 365c497a3SShuo Chen// Use of this source code is governed by a BSD-style license 465c497a3SShuo Chen// that can be found in the License file. 565c497a3SShuo Chen// 665c497a3SShuo Chen// Author: Shuo Chen (chenshuo at chenshuo dot com) 765c497a3SShuo Chen 865c497a3SShuo Chen#include "Timer.h" 965c497a3SShuo Chen 1065c497a3SShuo Chenusing namespace muduo; 1165c497a3SShuo Chen 1265c497a3SShuo Chenvoid Timer::restart(Timestamp now) 1365c497a3SShuo Chen{ 1465c497a3SShuo Chen if (repeat_) 1565c497a3SShuo Chen { 1665c497a3SShuo Chen expiration_ = addTime(now, interval_); 1765c497a3SShuo Chen } 1865c497a3SShuo Chen else 1965c497a3SShuo Chen { 2065c497a3SShuo Chen expiration_ = Timestamp::invalid(); 2165c497a3SShuo Chen } 2265c497a3SShuo Chen} 23