161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (C) 2022 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit BasicServicesKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport { AsyncCallback } from './@ohos.base';
2261847f8eSopenharmony_ci
2361847f8eSopenharmony_ci/**
2461847f8eSopenharmony_ci * System time and timezone.
2561847f8eSopenharmony_ci *
2661847f8eSopenharmony_ci * @namespace systemDateTime
2761847f8eSopenharmony_ci * @syscap SystemCapability.MiscServices.Time
2861847f8eSopenharmony_ci * @since 9
2961847f8eSopenharmony_ci */
3061847f8eSopenharmony_cideclare namespace systemDateTime {
3161847f8eSopenharmony_ci  /**
3261847f8eSopenharmony_ci   * Sets the system time.
3361847f8eSopenharmony_ci   *
3461847f8eSopenharmony_ci   * @permission ohos.permission.SET_TIME
3561847f8eSopenharmony_ci   * @param { number } time - Indicates the target timestamp(in milliseconds)
3661847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of setTime
3761847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
3861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
3961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;
4061847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
4161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use
4261847f8eSopenharmony_ci   * @since 9
4361847f8eSopenharmony_ci   */
4461847f8eSopenharmony_ci  function setTime(time: number, callback: AsyncCallback<void>): void;
4561847f8eSopenharmony_ci  /**
4661847f8eSopenharmony_ci   * Sets the system time.
4761847f8eSopenharmony_ci   *
4861847f8eSopenharmony_ci   * @permission ohos.permission.SET_TIME
4961847f8eSopenharmony_ci   * @param { number } time - Indicates the target timestamp(in milliseconds)
5061847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function
5161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
5261847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
5361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;
5461847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
5561847f8eSopenharmony_ci   * @systemapi Hide this for inner system use
5661847f8eSopenharmony_ci   * @since 9
5761847f8eSopenharmony_ci   */
5861847f8eSopenharmony_ci  function setTime(time: number): Promise<void>;
5961847f8eSopenharmony_ci
6061847f8eSopenharmony_ci  /**
6161847f8eSopenharmony_ci   * Obtains the number of milliseconds that have elapsed since the Unix epoch.
6261847f8eSopenharmony_ci   *
6361847f8eSopenharmony_ci   * @param { boolean } isNano - True if the result is in nanoseconds, otherwise in milliseconds
6461847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - The callback of getCurrentTime
6561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types;
6661847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
6761847f8eSopenharmony_ci   * @since 9
6861847f8eSopenharmony_ci   * @deprecated since 12
6961847f8eSopenharmony_ci   */
7061847f8eSopenharmony_ci  function getCurrentTime(isNano: boolean, callback: AsyncCallback<number>): void;
7161847f8eSopenharmony_ci
7261847f8eSopenharmony_ci  /**
7361847f8eSopenharmony_ci   * Obtains the number of milliseconds that have elapsed since the Unix epoch.
7461847f8eSopenharmony_ci   *
7561847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - The callback of getCurrentTime
7661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types;
7761847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
7861847f8eSopenharmony_ci   * @since 9
7961847f8eSopenharmony_ci   * @deprecated since 12
8061847f8eSopenharmony_ci   */
8161847f8eSopenharmony_ci  function getCurrentTime(callback: AsyncCallback<number>): void;
8261847f8eSopenharmony_ci
8361847f8eSopenharmony_ci  /**
8461847f8eSopenharmony_ci   * Obtains the number of milliseconds that have elapsed since the Unix epoch.
8561847f8eSopenharmony_ci   *
8661847f8eSopenharmony_ci   * @param { boolean } isNano - True if the result is in nanoseconds, otherwise in milliseconds
8761847f8eSopenharmony_ci   * @returns { Promise<number> } The promise returned by the function
8861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types;
8961847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
9061847f8eSopenharmony_ci   * @since 9
9161847f8eSopenharmony_ci   * @deprecated since 12
9261847f8eSopenharmony_ci   */
9361847f8eSopenharmony_ci  function getCurrentTime(isNano?: boolean): Promise<number>;
9461847f8eSopenharmony_ci
9561847f8eSopenharmony_ci  /**
9661847f8eSopenharmony_ci   * Obtains the number of timestamp that have elapsed since the Unix epoch.
9761847f8eSopenharmony_ci   *
9861847f8eSopenharmony_ci   * @param { boolean } [ isNanoseconds ] - True if the result is in nanoseconds, otherwise in milliseconds
9961847f8eSopenharmony_ci   * @returns { number } The timestamp returned of getTime.
10061847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
10161847f8eSopenharmony_ci   * @since 10
10261847f8eSopenharmony_ci   */
10361847f8eSopenharmony_ci  function getTime(isNanoseconds?: boolean): number;
10461847f8eSopenharmony_ci
10561847f8eSopenharmony_ci  /**
10661847f8eSopenharmony_ci   * Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time.
10761847f8eSopenharmony_ci   *
10861847f8eSopenharmony_ci   * @param { boolean } isNano - True if the result is in nanoseconds., otherwise in milliseconds
10961847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - The callback of getRealActiveTime
11061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types;
11161847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
11261847f8eSopenharmony_ci   * @since 9
11361847f8eSopenharmony_ci   * @deprecated since 12
11461847f8eSopenharmony_ci   */
11561847f8eSopenharmony_ci  function getRealActiveTime(isNano: boolean, callback: AsyncCallback<number>): void;
11661847f8eSopenharmony_ci
11761847f8eSopenharmony_ci  /**
11861847f8eSopenharmony_ci   * Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time.
11961847f8eSopenharmony_ci   *
12061847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - The callback of getRealActiveTime
12161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types;
12261847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
12361847f8eSopenharmony_ci   * @since 9
12461847f8eSopenharmony_ci   * @deprecated since 12
12561847f8eSopenharmony_ci   */
12661847f8eSopenharmony_ci  function getRealActiveTime(callback: AsyncCallback<number>): void;
12761847f8eSopenharmony_ci
12861847f8eSopenharmony_ci  /**
12961847f8eSopenharmony_ci   * Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time.
13061847f8eSopenharmony_ci   *
13161847f8eSopenharmony_ci   * @param { boolean } [isNano] - True if the result is in nanoseconds, otherwise in milliseconds
13261847f8eSopenharmony_ci   * @returns { Promise<number> } The promise returned by the function
13361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types;
13461847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
13561847f8eSopenharmony_ci   * @since 9
13661847f8eSopenharmony_ci   * @deprecated since 12
13761847f8eSopenharmony_ci   */
13861847f8eSopenharmony_ci  function getRealActiveTime(isNano?: boolean): Promise<number>;
13961847f8eSopenharmony_ci
14061847f8eSopenharmony_ci  /**
14161847f8eSopenharmony_ci   * Obtains the number of milliseconds elapsed since the system was booted, including deep sleep time.
14261847f8eSopenharmony_ci   *
14361847f8eSopenharmony_ci   * @param { boolean } isNano - True if the result is in nanoseconds, otherwise in milliseconds
14461847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - The callback of getRealTime
14561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types;
14661847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
14761847f8eSopenharmony_ci   * @since 9
14861847f8eSopenharmony_ci   * @deprecated since 12
14961847f8eSopenharmony_ci   */
15061847f8eSopenharmony_ci  function getRealTime(isNano: boolean, callback: AsyncCallback<number>): void;
15161847f8eSopenharmony_ci
15261847f8eSopenharmony_ci  /**
15361847f8eSopenharmony_ci   * Obtains the number of milliseconds elapsed since the system was booted, including deep sleep time.
15461847f8eSopenharmony_ci   *
15561847f8eSopenharmony_ci   * @param { AsyncCallback<number> } callback - The callback of getRealTime
15661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types;
15761847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
15861847f8eSopenharmony_ci   * @since 9
15961847f8eSopenharmony_ci   * @deprecated since 12
16061847f8eSopenharmony_ci   */
16161847f8eSopenharmony_ci  function getRealTime(callback: AsyncCallback<number>): void;
16261847f8eSopenharmony_ci
16361847f8eSopenharmony_ci  /**
16461847f8eSopenharmony_ci   * Obtains the number of milliseconds elapsed since the system was booted, including deep sleep time.
16561847f8eSopenharmony_ci   *
16661847f8eSopenharmony_ci   * @param { boolean } [isNano] - True if the result is in nanoseconds, otherwise in milliseconds
16761847f8eSopenharmony_ci   * @returns { Promise<number> } The promise returned by the function
16861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Incorrect parameter types;
16961847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
17061847f8eSopenharmony_ci   * @since 9
17161847f8eSopenharmony_ci   * @deprecated since 12
17261847f8eSopenharmony_ci   */
17361847f8eSopenharmony_ci  function getRealTime(isNano?: boolean): Promise<number>;
17461847f8eSopenharmony_ci
17561847f8eSopenharmony_ci  /**
17661847f8eSopenharmony_ci   * Indicates time type.
17761847f8eSopenharmony_ci   *
17861847f8eSopenharmony_ci   * @enum { number } TimeType
17961847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
18061847f8eSopenharmony_ci   * @since 10
18161847f8eSopenharmony_ci   */
18261847f8eSopenharmony_ci  enum TimeType {
18361847f8eSopenharmony_ci    /**
18461847f8eSopenharmony_ci     * Indicates the time elapsed since the system was booted, including deep sleep time.
18561847f8eSopenharmony_ci     *
18661847f8eSopenharmony_ci     * @syscap SystemCapability.MiscServices.Time
18761847f8eSopenharmony_ci     * @since 10
18861847f8eSopenharmony_ci     */
18961847f8eSopenharmony_ci    STARTUP,
19061847f8eSopenharmony_ci
19161847f8eSopenharmony_ci    /**
19261847f8eSopenharmony_ci     * Indicates the time elapsed since the system was booted, not including deep sleep time.
19361847f8eSopenharmony_ci     *
19461847f8eSopenharmony_ci     * @syscap SystemCapability.MiscServices.Time
19561847f8eSopenharmony_ci     * @since 10
19661847f8eSopenharmony_ci     */
19761847f8eSopenharmony_ci    ACTIVE
19861847f8eSopenharmony_ci  }
19961847f8eSopenharmony_ci
20061847f8eSopenharmony_ci  /**
20161847f8eSopenharmony_ci   * Obtains the number of milliseconds since the system has been running.
20261847f8eSopenharmony_ci   *
20361847f8eSopenharmony_ci   * @param { TimeType } timeType - indicates the type of get uptime. It can only be `STARTUP` or `ACTIVE`.
20461847f8eSopenharmony_ci   * @param { boolean } [ isNanoseconds ] - True if the result is in nanoseconds, otherwise in milliseconds
20561847f8eSopenharmony_ci   * @returns { number } The timestamp returned of getUpTime.
20661847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
20761847f8eSopenharmony_ci   * @since 10
20861847f8eSopenharmony_ci   */
20961847f8eSopenharmony_ci  /**
21061847f8eSopenharmony_ci   * Obtains the number of milliseconds since the system has been running.
21161847f8eSopenharmony_ci   *
21261847f8eSopenharmony_ci   * @param { TimeType } timeType - indicates the type of get uptime. It can only be `STARTUP` or `ACTIVE`.
21361847f8eSopenharmony_ci   * @param { boolean } [ isNanoseconds ] - True if the result is in nanoseconds, otherwise in milliseconds
21461847f8eSopenharmony_ci   * @returns { number } The timestamp returned of getUpTime.
21561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types;
21661847f8eSopenharmony_ci   *     3. Parameter verification failed. This error code was added due to missing issues.
21761847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
21861847f8eSopenharmony_ci   * @since 12
21961847f8eSopenharmony_ci   */
22061847f8eSopenharmony_ci  function getUptime(timeType: TimeType, isNanoseconds?: boolean): number;
22161847f8eSopenharmony_ci
22261847f8eSopenharmony_ci  /**
22361847f8eSopenharmony_ci   * Sets the system time.
22461847f8eSopenharmony_ci   *
22561847f8eSopenharmony_ci   * @permission ohos.permission.SET_TIME
22661847f8eSopenharmony_ci   * @param { Date } date - The target date, it must > 0
22761847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of setDate
22861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
22961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
23061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;
23161847f8eSopenharmony_ci   *     3.Parameter verification failed;
23261847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
23361847f8eSopenharmony_ci   * @systemapi Hide this for inner system use
23461847f8eSopenharmony_ci   * @since 9
23561847f8eSopenharmony_ci   * @deprecated since 10
23661847f8eSopenharmony_ci   * @useinstead systemDateTime.setTime
23761847f8eSopenharmony_ci   */
23861847f8eSopenharmony_ci  function setDate(date: Date, callback: AsyncCallback<void>): void;
23961847f8eSopenharmony_ci
24061847f8eSopenharmony_ci  /**
24161847f8eSopenharmony_ci   * Sets the system time.
24261847f8eSopenharmony_ci   * 
24361847f8eSopenharmony_ci   * @permission ohos.permission.SET_TIME
24461847f8eSopenharmony_ci   * @param { Date } date - The target date, it must > 0
24561847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function
24661847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
24761847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
24861847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;
24961847f8eSopenharmony_ci   *     3.Parameter verification failed;
25061847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
25161847f8eSopenharmony_ci   * @systemapi Hide this for inner system use
25261847f8eSopenharmony_ci   * @since 9
25361847f8eSopenharmony_ci   * @deprecated since 10
25461847f8eSopenharmony_ci   * @useinstead systemDateTime.setTime
25561847f8eSopenharmony_ci   */
25661847f8eSopenharmony_ci  function setDate(date: Date): Promise<void>;
25761847f8eSopenharmony_ci
25861847f8eSopenharmony_ci  /**
25961847f8eSopenharmony_ci   * Obtains the system date.
26061847f8eSopenharmony_ci   *
26161847f8eSopenharmony_ci   * @param { AsyncCallback<Date> } callback - The callback of getDate
26261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.System error;
26361847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
26461847f8eSopenharmony_ci   * @since 9
26561847f8eSopenharmony_ci   * @deprecated since 10
26661847f8eSopenharmony_ci   * @useinstead new Date()
26761847f8eSopenharmony_ci   */
26861847f8eSopenharmony_ci  function getDate(callback: AsyncCallback<Date>): void;
26961847f8eSopenharmony_ci
27061847f8eSopenharmony_ci  /**
27161847f8eSopenharmony_ci   * Obtains the system date.
27261847f8eSopenharmony_ci   *
27361847f8eSopenharmony_ci   * @returns { Promise<Date> } The promise returned by the function
27461847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.System error;
27561847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
27661847f8eSopenharmony_ci   * @since 9
27761847f8eSopenharmony_ci   * @deprecated since 10
27861847f8eSopenharmony_ci   * @useinstead new Date()
27961847f8eSopenharmony_ci   */
28061847f8eSopenharmony_ci  function getDate(): Promise<Date>;
28161847f8eSopenharmony_ci
28261847f8eSopenharmony_ci  /**
28361847f8eSopenharmony_ci   * Sets the system time zone.
28461847f8eSopenharmony_ci   *
28561847f8eSopenharmony_ci   * @permission ohos.permission.SET_TIME_ZONE
28661847f8eSopenharmony_ci   * @param { string } timezone - The system time zone
28761847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - The callback of setTimezone
28861847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
28961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
29061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;
29161847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
29261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use
29361847f8eSopenharmony_ci   * @since 9
29461847f8eSopenharmony_ci   */
29561847f8eSopenharmony_ci  function setTimezone(timezone: string, callback: AsyncCallback<void>): void;
29661847f8eSopenharmony_ci
29761847f8eSopenharmony_ci  /**
29861847f8eSopenharmony_ci   * Sets the system time zone.
29961847f8eSopenharmony_ci   *
30061847f8eSopenharmony_ci   * @permission ohos.permission.SET_TIME_ZONE
30161847f8eSopenharmony_ci   * @param { string } timezone -  The system time zone
30261847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function
30361847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission denied
30461847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
30561847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types;
30661847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
30761847f8eSopenharmony_ci   * @systemapi Hide this for inner system use
30861847f8eSopenharmony_ci   * @since 9
30961847f8eSopenharmony_ci   */
31061847f8eSopenharmony_ci  function setTimezone(timezone: string): Promise<void>;
31161847f8eSopenharmony_ci
31261847f8eSopenharmony_ci  /**
31361847f8eSopenharmony_ci   * Obtains the system time zone.
31461847f8eSopenharmony_ci   *
31561847f8eSopenharmony_ci   * @param { AsyncCallback<string> } callback - The callback of getTimezone
31661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.System error.
31761847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
31861847f8eSopenharmony_ci   * @since 9
31961847f8eSopenharmony_ci   */
32061847f8eSopenharmony_ci  /**
32161847f8eSopenharmony_ci   * Obtains the system time zone.
32261847f8eSopenharmony_ci   *
32361847f8eSopenharmony_ci   * @param { AsyncCallback<string> } callback - The callback of getTimezone
32461847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
32561847f8eSopenharmony_ci   * @since 12
32661847f8eSopenharmony_ci   */
32761847f8eSopenharmony_ci  function getTimezone(callback: AsyncCallback<string>): void;
32861847f8eSopenharmony_ci
32961847f8eSopenharmony_ci  /**
33061847f8eSopenharmony_ci   * Obtains the system time zone.
33161847f8eSopenharmony_ci   *
33261847f8eSopenharmony_ci   * @returns { Promise<string> } The promise returned by the function
33361847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.System error.
33461847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
33561847f8eSopenharmony_ci   * @since 9
33661847f8eSopenharmony_ci   */
33761847f8eSopenharmony_ci  /**
33861847f8eSopenharmony_ci   * Obtains the system time zone.
33961847f8eSopenharmony_ci   *
34061847f8eSopenharmony_ci   * @returns { Promise<string> } The promise returned by the function
34161847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
34261847f8eSopenharmony_ci   * @since 12
34361847f8eSopenharmony_ci   */
34461847f8eSopenharmony_ci  function getTimezone(): Promise<string>;
34561847f8eSopenharmony_ci
34661847f8eSopenharmony_ci  /**
34761847f8eSopenharmony_ci   * Obtains the system time zone.
34861847f8eSopenharmony_ci   *
34961847f8eSopenharmony_ci   * @returns { string } The timezone returned of getTimezoneSync.
35061847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
35161847f8eSopenharmony_ci   * @since 10
35261847f8eSopenharmony_ci   */
35361847f8eSopenharmony_ci  function getTimezoneSync(): string;
35461847f8eSopenharmony_ci
35561847f8eSopenharmony_ci  /**
35661847f8eSopenharmony_ci   * Updates the NTP time from the ntp server. This method will only update NTP time once within an hour.
35761847f8eSopenharmony_ci   *
35861847f8eSopenharmony_ci   * @returns { Promise<void> } The promise returned by the function
35961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
36061847f8eSopenharmony_ci   * @throws { BusinessError } 13000001 - Network connection error or OS error.
36161847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
36261847f8eSopenharmony_ci   * @systemapi Hide this for inner system use
36361847f8eSopenharmony_ci   * @since 13
36461847f8eSopenharmony_ci   */
36561847f8eSopenharmony_ci  function updateNtpTime(): Promise<void>;
36661847f8eSopenharmony_ci
36761847f8eSopenharmony_ci  /**
36861847f8eSopenharmony_ci   * Obtains the current time of milliseconds since the Unix epoch calculated based on the last updated NTP time.
36961847f8eSopenharmony_ci   *
37061847f8eSopenharmony_ci   * @returns { number } The current NTP time returned of getNtpTime.
37161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
37261847f8eSopenharmony_ci   * @throws { BusinessError } 13000002 - updateNtpTime() is not called successfully.
37361847f8eSopenharmony_ci   * @syscap SystemCapability.MiscServices.Time
37461847f8eSopenharmony_ci   * @systemapi Hide this for inner system use
37561847f8eSopenharmony_ci   * @since 13
37661847f8eSopenharmony_ci   */
37761847f8eSopenharmony_ci  function getNtpTime(): number;
37861847f8eSopenharmony_ci}
37961847f8eSopenharmony_ci
38061847f8eSopenharmony_ciexport default systemDateTime;