1 /* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef PANDA_LIBPANDABASE_PBASE_OS_TIME_H_ 17 #define PANDA_LIBPANDABASE_PBASE_OS_TIME_H_ 18 19 #ifdef PANDA_TARGET_UNIX 20 #include "platforms/unix/libpandabase/time.h" 21 #elif PANDA_TARGET_WINDOWS 22 #include "platforms/windows/libpandabase/time.h" 23 #else 24 #error "Unsupported platform" 25 #endif // PANDA_TARGET_UNIX 26 27 #include <macros.h> 28 29 #include <cstdint> 30 31 WEAK_FOR_LTO_START 32 33 namespace ark::os::time { 34 35 static constexpr uint64_t MICRO_TO_NANO = 1000; 36 static constexpr uint64_t MILLIS_TO_MICRO = 1000; 37 38 PANDA_PUBLIC_API uint64_t GetClockTimeInMicro(); 39 PANDA_PUBLIC_API uint64_t GetClockTimeInMilli(); 40 PANDA_PUBLIC_API uint64_t GetClockTimeInThreadCpuTime(); 41 42 } // namespace ark::os::time 43 44 WEAK_FOR_LTO_END 45 46 #endif // PANDA_LIBPANDABASE_PBASE_OS_TIME_H_ 47