Ice 3.7 C++98 API Reference
Loading...
Searching...
No Matches
StopWatch.h
Go to the documentation of this file.
1//
2// Copyright (c) ZeroC, Inc. All rights reserved.
3//
4
5#ifndef ICE_UTIL_STOPWATCH_H
6#define ICE_UTIL_STOPWATCH_H
7
8#include <IceUtil/Time.h>
9
10namespace IceUtilInternal
11{
12
13class StopWatch
14{
15public:
16
17 StopWatch() { }
18
19 void start()
20 {
22 }
23
24 IceUtil::Int64 stop()
25 {
26 assert(isStarted());
28 _s = IceUtil::Time();
29 return d;
30 }
31
32 bool isStarted() const
33 {
34 return _s != IceUtil::Time();
35 }
36
37 IceUtil::Int64 delay()
38 {
39 return (IceUtil::Time::now(IceUtil::Time::Monotonic) - _s).toMicroSeconds();
40 }
41
42private:
43
44 IceUtil::Time _s;
45};
46
47} // End namespace IceUtilInternal
48
49#endif
static Time now(Clock=Realtime)
@ Monotonic
Definition Time.h:27
long long Int64
Definition Config.h:342