xref: /aosp_15_r20/external/stressapptest/src/clock.h (revision 424fb153c814cbcb3e8904974796228774b3229a)
1*424fb153SAndroid Build Coastguard Worker // Copyright 2010 Google Inc. All Rights Reserved.
2*424fb153SAndroid Build Coastguard Worker // Author: cferris
3*424fb153SAndroid Build Coastguard Worker 
4*424fb153SAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License");
5*424fb153SAndroid Build Coastguard Worker // you may not use this file except in compliance with the License.
6*424fb153SAndroid Build Coastguard Worker // You may obtain a copy of the License at
7*424fb153SAndroid Build Coastguard Worker 
8*424fb153SAndroid Build Coastguard Worker //      http://www.apache.org/licenses/LICENSE-2.0
9*424fb153SAndroid Build Coastguard Worker 
10*424fb153SAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software
11*424fb153SAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS,
12*424fb153SAndroid Build Coastguard Worker // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*424fb153SAndroid Build Coastguard Worker // See the License for the specific language governing permissions and
14*424fb153SAndroid Build Coastguard Worker // limitations under the License.
15*424fb153SAndroid Build Coastguard Worker 
16*424fb153SAndroid Build Coastguard Worker #ifndef STRESSAPPTEST_CLOCK_H_  // NOLINT
17*424fb153SAndroid Build Coastguard Worker #define STRESSAPPTEST_CLOCK_H_
18*424fb153SAndroid Build Coastguard Worker 
19*424fb153SAndroid Build Coastguard Worker #include <time.h>
20*424fb153SAndroid Build Coastguard Worker 
21*424fb153SAndroid Build Coastguard Worker // This class implements a clock that can be overriden for unit tests.
22*424fb153SAndroid Build Coastguard Worker class Clock {
23*424fb153SAndroid Build Coastguard Worker  public:
~Clock()24*424fb153SAndroid Build Coastguard Worker   virtual ~Clock() {}
25*424fb153SAndroid Build Coastguard Worker 
Now()26*424fb153SAndroid Build Coastguard Worker   virtual time_t Now() { return time(NULL); }
27*424fb153SAndroid Build Coastguard Worker };
28*424fb153SAndroid Build Coastguard Worker 
29*424fb153SAndroid Build Coastguard Worker #endif  // STRESSAPPTEST_CLOCK_H_ NOLINT
30