1 /* 2 * Copyright (c) 2023-2023 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 OHOS_DEFERRED_PROCESSING_SERVICE_STEADY_CLOCK_H 17 #define OHOS_DEFERRED_PROCESSING_SERVICE_STEADY_CLOCK_H 18 #define EXPORT_API __attribute__((visibility("default"))) 19 20 #include <cstdint> 21 #include <functional> 22 #include <map> 23 #include <memory> 24 #include <mutex> 25 #include <queue> 26 #include <string> 27 #include <vector> 28 #include "timer/camera_deferred_timer.h" 29 30 namespace OHOS { 31 namespace CameraStandard { 32 namespace DeferredProcessing { 33 class SteadyClock { 34 public: 35 EXPORT_API static uint64_t GetTimestampMilli(); 36 static uint64_t GetTimestampMicro(); 37 static uint64_t GetElapsedTimeMs(uint64_t startMs); 38 static std::chrono::milliseconds GetRemainingTimeMs(uint64_t expirationTimeMs); 39 SteadyClock(); 40 ~SteadyClock(); 41 void Reset(); 42 uint64_t GetElapsedTimeMs(); 43 44 private: 45 std::chrono::time_point<std::chrono::steady_clock> start_; 46 }; 47 } //namespace DeferredProcessing 48 } // namespace CameraStandard 49 } // namespace OHOS 50 #endif // OHOS_DEFERRED_PROCESSING_SERVICE_STEADY_CLOCK_H 51