1/*
2 * Copyright (c) 2020-2021 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 GRAPHIC_LITE_HAL_TICK_H
17#define GRAPHIC_LITE_HAL_TICK_H
18
19#include <cstdint>
20
21#include "gfx_utils/heap_base.h"
22
23namespace OHOS {
24/** @brief Class for calculate the time. */
25class HALTick : public HeapBase {
26public:
27    /**
28     * Gets the instance
29     *
30     * @returns The instance.
31     */
32    static HALTick& GetInstance();
33
34    /**
35     * Gets the milliseconds since start up
36     *
37     * @returns The elapsed time.
38     */
39    uint32_t GetTime();
40
41    /**
42     * Gets elapse milliseconds since the startTime
43     *
44     * @param startTime The start time.
45     *
46     * @returns The elapse time.
47     */
48    uint32_t GetElapseTime(uint32_t startTime);
49
50private:
51    /** Default constructor */
52    HALTick() {}
53    /** Destructor */
54    ~HALTick() {}
55    static constexpr uint32_t MILLISEC_TO_NANOSEC = 1000000;
56    static constexpr uint16_t SEC_TO_MILLISEC = 1000;
57};
58} // namespace OHOS
59#endif // GRAPHIC_LITE_HAL_TICK_H
60