1/*
2 * Copyright (c) 2022 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 FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_SERVICES_TRANSIENT_TASK_INCLUDE_TIME_PROVIDER_H
17#define FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_SERVICES_TRANSIENT_TASK_INCLUDE_TIME_PROVIDER_H
18
19#include <cstdint>
20#include <ctime>
21
22namespace OHOS {
23namespace BackgroundTaskMgr {
24enum ClockType {
25    CLOCK_TYPE_REALTIME = CLOCK_REALTIME,
26    CLOCK_TYPE_MONOTONIC = CLOCK_MONOTONIC,
27};
28
29enum TimeConstant : int64_t {
30    NSEC_PER_MIN = 60000000000LL,
31    NSEC_PER_SEC = 1000000000LL,
32    NSEC_PER_MSEC = 1000000LL,
33    NSEC_PER_USEC = 1000LL,
34    USEC_PER_SEC = 1000000LL,
35    USEC_PER_MSEC = 1000LL,
36    MSEC_PER_DAY = 86400000LL,
37    MSEC_PER_DAWN = 21600000LL,
38    MSEC_PER_HOUR = 3600000LL,
39    MSEC_PER_MIN = 60000LL,
40    MSEC_PER_SEC = 1000LL,
41    SEC_PER_MIN = 60LL,
42    SEC_PER_HOUR = 3600LL,
43    SEC_PER_DAY = 86400LL,
44    MIN_PER_HOUR = 60LL,
45    HOUR_PER_DAY = 24LL,
46};
47
48class TimeProvider {
49public:
50    static int64_t GetCurrentTime(ClockType type = CLOCK_TYPE_MONOTONIC);
51};
52}  // namespace BackgroundTaskMgr
53}  // namespace OHOS
54#endif  // FOUNDATION_RESOURCESCHEDULE_BACKGROUND_TASK_MGR_SERVICES_TRANSIENT_TASK_INCLUDE_TIME_PROVIDER_H