• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Chipsea Technologies (Shenzhen) Corp., Ltd. All rights reserved.
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 #ifndef DRIVER_PUBLIC_H
16 #define DRIVER_PUBLIC_H
17 
18 /*chipsea_ohos proguard begin*/
19 #include "cs_proguard.h"
20 /*chipsea_ohos proguard end*/
21 
22 #include <time.h>
23 
24 #define TIME_FUNC_GRP_0_IMPL    1
25 #define TIME_FUNC_GRP_1_IMPL    0
26 
27 enum time_origin_t {
28     /** Since boot time */
29     SINCE_BOOT,
30     /** Since Epoch : 1970-01-01 00:00:00 +0000 (UTC) */
31     SINCE_EPOCH,
32 };
33 
34 #if TIME_FUNC_GRP_0_IMPL
35 #define YEAR0          1900
36 #define EPOCH_YEAR     1970
37 
38 struct tm* gmtime_offset_r(const time_t* timer, struct tm *st_time, int offset);
39 time_t mk_gmtime_offset_r(const struct tm *st_time, int offset);
40 #endif
41 
42 void cs_time_init(uint32_t sec, uint32_t usec);
43 void cs_time_update(uint32_t sec, uint32_t usec);
44 int cs_time_get(enum time_origin_t origin, uint32_t *sec, uint32_t *usec);
45 int cs_time_us_get(enum time_origin_t origin, uint64_t *usec);
46 #endif
47 
48