Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | List of all members
net_instaweb::Timer Class Referenceabstract

Timer interface, made virtual so it can be mocked for tests. More...

#include "timer.h"

Inheritance diagram for net_instaweb::Timer:
net_instaweb::AprTimer net_instaweb::MockTimer net_instaweb::PosixTimer

Public Member Functions

virtual int64 NowMs () const
 Returns number of milliseconds since 1970.
 
virtual int64 NowUs () const =0
 Returns number of microseconds since 1970.
 
virtual void SleepMs (int64 ms)
 Sleep for given number of milliseconds.
 
virtual void SleepUs (int64 us)=0
 Sleep for given number of microseconds.
 

Static Public Attributes

static const int64 kSecondMs = 1000
 
static const int64 kMsUs = 1000
 
static const int64 kSecondUs = kMsUs * kSecondMs
 
static const int64 kSecondNs = 1000 * kSecondUs
 
static const int64 kMinuteMs = 60 * kSecondMs
 
static const int64 kMinuteUs = 60 * kSecondUs
 
static const int64 kHourMs = 60 * kMinuteMs
 
static const int64 kDayMs = 24 * kHourMs
 
static const int64 kWeekMs = 7 * kDayMs
 
static const int64 kMonthMs = 31 * kDayMs
 
static const int64 kYearMs = 365 * kDayMs
 

Detailed Description

Timer interface, made virtual so it can be mocked for tests.

Member Data Documentation

const int64 net_instaweb::Timer::kSecondMs = 1000
static

Note: it's important that these stay compile-time constants, to avoid weird init order surprises. (Noticed in the wild on Mac). If you get a link error due to one of these missing, you're trying to pass it in by a const reference. You can do something like * 1 to sidestep the issue.


The documentation for this class was generated from the following file: