Paul Stewart | c2350ee | 2011-10-19 12:28:40 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SHILL_TIME_H_ |
| 6 | #define SHILL_TIME_H_ |
| 7 | |
| 8 | #include <sys/time.h> |
| 9 | |
| 10 | #include <base/lazy_instance.h> |
| 11 | |
| 12 | namespace shill { |
| 13 | |
| 14 | // A "sys/time.h" abstraction allowing mocking in tests. |
| 15 | class Time { |
| 16 | public: |
| 17 | virtual ~Time(); |
| 18 | |
| 19 | static Time *GetInstance(); |
| 20 | |
| 21 | // gettimeofday |
| 22 | virtual int GetTimeOfDay(struct timeval *tv, struct timezone *tz); |
| 23 | |
| 24 | protected: |
| 25 | Time(); |
| 26 | |
| 27 | private: |
| 28 | friend struct base::DefaultLazyInstanceTraits<Time>; |
| 29 | |
| 30 | DISALLOW_COPY_AND_ASSIGN(Time); |
| 31 | }; |
| 32 | |
| 33 | } // namespace shill |
| 34 | |
| 35 | #endif // SHILL_TIME_H_ |