1 /*
2  * Copyright (c) 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 NTP_TIME_HELPER_H
17 #define NTP_TIME_HELPER_H
18 #ifdef FEATURE_GNSS_SUPPORT
19 #ifdef TIME_SERVICE_ENABLE
20 
21 #include <string>
22 #include "time_manager.h"
23 
24 namespace OHOS {
25 namespace Location {
26 
27 struct NtpTrustedTime {
28     int64_t ntpTime = 0;
29     int64_t ageMillis = 0;
30     int64_t elapsedRealTime = 0;
31 };
32 
33 class NtpTimeHelper {
34 public:
35     static NtpTimeHelper* GetInstance();
36     void RetrieveAndInjectNtpTime();
37 
38 private:
39     NtpTimeHelper() = default;
40     ~NtpTimeHelper() = default;
41 
42     NtpTrustedTime ntpResult_;
43 };
44 } // namespace Location
45 } // namespace OHOS
46 
47 #endif // TIME_SERVICE_ENABLE
48 #endif // FEATURE_GNSS_SUPPORT
49 #endif // NTP_TIME_HELPER_H
50