1- /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
1+ /* Copyright 2024 The TensorFlow Authors. All Rights Reserved.
22
33Licensed under the Apache License, Version 2.0 (the "License");
44you may not use this file except in compliance with the License.
@@ -12,54 +12,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212See the License for the specific language governing permissions and
1313limitations under the License.
1414==============================================================================*/
15+
1516#ifndef TENSORFLOW_TSL_PLATFORM_ENV_TIME_H_
1617#define TENSORFLOW_TSL_PLATFORM_ENV_TIME_H_
1718
18- #include < stdint.h>
19-
20- #include " tsl/platform/types.h"
21-
22- namespace tsl {
23-
24- // / \brief An interface used by the tsl implementation to
25- // / access timer related operations.
26- class EnvTime {
27- public:
28- static constexpr uint64 kMicrosToPicos = 1000ULL * 1000ULL ;
29- static constexpr uint64 kMicrosToNanos = 1000ULL ;
30- static constexpr uint64 kMillisToMicros = 1000ULL ;
31- static constexpr uint64 kMillisToNanos = 1000ULL * 1000ULL ;
32- static constexpr uint64 kNanosToPicos = 1000ULL ;
33- static constexpr uint64 kSecondsToMillis = 1000ULL ;
34- static constexpr uint64 kSecondsToMicros = 1000ULL * 1000ULL ;
35- static constexpr uint64 kSecondsToNanos = 1000ULL * 1000ULL * 1000ULL ;
36-
37- EnvTime () = default ;
38- virtual ~EnvTime () = default ;
39-
40- // / \brief Returns the number of nano-seconds since the Unix epoch.
41- static uint64 NowNanos ();
42-
43- // / \brief Returns the number of micro-seconds since the Unix epoch.
44- static uint64 NowMicros () { return NowNanos () / kMicrosToNanos ; }
45-
46- // / \brief Returns the number of seconds since the Unix epoch.
47- static uint64 NowSeconds () { return NowNanos () / kSecondsToNanos ; }
48-
49- // / \brief A version of NowNanos() that may be overridden by a subclass.
50- virtual uint64 GetOverridableNowNanos () const { return NowNanos (); }
51-
52- // / \brief A version of NowMicros() that may be overridden by a subclass.
53- virtual uint64 GetOverridableNowMicros () const {
54- return GetOverridableNowNanos () / kMicrosToNanos ;
55- }
56-
57- // / \brief A version of NowSeconds() that may be overridden by a subclass.
58- virtual uint64 GetOverridableNowSeconds () const {
59- return GetOverridableNowNanos () / kSecondsToNanos ;
60- }
61- };
62-
63- } // namespace tsl
19+ #include "xla/tsl/platform/env_time.h"
6420
6521#endif // TENSORFLOW_TSL_PLATFORM_ENV_TIME_H_
0 commit comments