mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-07 06:03:30 +00:00
!12882 时间时区子系统新增updateNtpTime及getNtpTime接口
Merge pull request !12882 from Gin/time_ntp_debug
This commit is contained in:
commit
8d3806f89b
24
api/@ohos.systemDateTime.d.ts
vendored
24
api/@ohos.systemDateTime.d.ts
vendored
@ -351,6 +351,30 @@ declare namespace systemDateTime {
|
||||
* @since 10
|
||||
*/
|
||||
function getTimezoneSync(): string;
|
||||
|
||||
/**
|
||||
* Updates the NTP time from the ntp server. This method will only update NTP time once within an hour.
|
||||
*
|
||||
* @returns { Promise<void> } The promise returned by the function
|
||||
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
|
||||
* @throws { BusinessError } 13000001 - Network connection error or OS error.
|
||||
* @syscap SystemCapability.MiscServices.Time
|
||||
* @systemapi Hide this for inner system use
|
||||
* @since 13
|
||||
*/
|
||||
function updateNtpTime(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Obtains the current time of milliseconds since the Unix epoch calculated based on the last updated NTP time.
|
||||
*
|
||||
* @returns { number } The current NTP time returned of getNtpTime.
|
||||
* @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
|
||||
* @throws { BusinessError } 13000002 - updateNtpTime() is not called successfully.
|
||||
* @syscap SystemCapability.MiscServices.Time
|
||||
* @systemapi Hide this for inner system use
|
||||
* @since 13
|
||||
*/
|
||||
function getNtpTime(): number;
|
||||
}
|
||||
|
||||
export default systemDateTime;
|
Loading…
Reference in New Issue
Block a user