提交 ad8cb140 编写于 作者: E ester.zhou

Update timer docs (11864)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 57c721e4
......@@ -453,7 +453,7 @@ Sets the system time zone. This API uses an asynchronous callback to return the
| Name | Type | Mandatory| Description |
| -------- | ------------- | ---- | -------------------------- |
| timezone | string | Yes | System time zone to set. |
| timezone | string | Yes | System time zone to set. For details, see [Supported System Time Zones](#supported-system-time-zones). |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example**
......@@ -482,7 +482,7 @@ Sets the system time zone. This API uses a promise to return the result.
| Name | Type | Mandatory| Description |
| -------- | ------ | ---- | ---------- |
| timezone | string | Yes | System time zone to set.|
| timezone | string | Yes | System time zone to set. For details, see [Supported System Time Zones](#supported-system-time-zones).|
**Return value**
......@@ -512,7 +512,7 @@ Obtains the system time zone. This API uses an asynchronous callback to return t
| Name | Type | Mandatory| Description |
| -------- | --------- | ---- | ------------------------ |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the system time zone.|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the system time zone. For details, see [Supported System Time Zones](#supported-system-time-zones).|
**Example**
......@@ -538,7 +538,7 @@ Obtains the system time zone. This API uses a promise to return the result.
| Type | Description |
| --------------------- | ------------------------------------- |
| Promise&lt;string&gt; | Promise used to return the system time zone.|
| Promise&lt;string&gt; | Promise used to return the system time zone. For details, see [Supported System Time Zones](#supported-system-time-zones).|
**Example**
......@@ -549,3 +549,41 @@ systemTime.getTimezone().then((data) => {
console.error(`Failed to get system time zone. Cause:` + JSON.stringify(error));
});
```
## Supported System Time Zones
The following table lists the supported system time zones and the respective offset (unit: h) between each time zone and time zone 0.
| Time Zone | Offset |
| ------------------------------ | --------------------- |
| Antarctica/McMurdo | 12 |
| America/Argentina/Buenos_Aires | -3 |
| Australia/Sydney | 10 |
| America/Noronha | -2 |
| America/St_Johns | -3 |
| Africa/Kinshasa | 1 |
| America/Santiago | -3 |
| Asia/Shanghai | 8 |
| Asia/Nicosia | 3 |
| Europe/Berlin | 2 |
| America/Guayaquil | -5 |
| Europe/Madrid | 2 |
| Pacific/Pohnpei | 11 |
| America/Godthab | -2 |
| Asia/Jakarta | 7 |
| Pacific/Tarawa | 12 |
| Asia/Almaty | 6 |
| Pacific/Majuro | 12 |
| Asia/Ulaanbaatar | 8 |
| America/Mexico_City | -5 |
| Asia/Kuala_Lumpur | 8 |
| Pacific/Auckland | 12 |
| Pacific/Tahiti | -10 |
| Pacific/Port_Moresby | 10 |
| Asia/Gaza | 3 |
| Europe/Lisbon | 1 |
| Europe/Moscow | 3 |
| Europe/Kiev | 3 |
| Pacific/Wake | 12 |
| America/New_York | -4 |
| Asia/Tashkent | 5 |
......@@ -8,7 +8,7 @@ The **Timer** module provides basic timer capabilities. You can use the APIs of
## setTimeout
setTimeout(handler[,delay[,…args]]): number
setTimeout(handler: Function | string, delay?: number, ...arguments: any[]): number
Sets a timer for the system to call a function after the timer goes off.
......@@ -18,9 +18,9 @@ Sets a timer for the system to call a function after the timer goes off.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| handler | Function | Yes| Function to be called after the timer goes off.|
| handler | Function \| string | Yes| Function to be called after the timer goes off.|
| delay | number | No| Number of milliseconds delayed before the execution. If this parameter is left empty, the default value **0** is used, which means that the execution starts immediately or as soon as possible.|
| ...args | Array&lt;any&gt; | No| Additional parameters to pass to the handler after the timer goes off.|
| ...arguments | Array&lt;any&gt; | No| Additional parameters to pass to the handler after the timer goes off.|
**Return value**
......@@ -71,7 +71,7 @@ Cancels the timer created via **setTimeout()**.
## setInterval
setInterval(handler[, delay[, ...args]]): number
setInterval(handler: Function | string, delay: number, ...arguments: any[]): number
Sets a repeating timer for the system to repeatedly call a function at a fixed interval.
......@@ -81,9 +81,9 @@ Sets a repeating timer for the system to repeatedly call a function at a fixed i
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| handler | Function | Yes| Function to be called repeatedly.|
| delay | number | No| Number of milliseconds delayed before the execution.|
| ...args | Array&lt;any&gt; | No| Additional parameters to pass to the handler after the timer goes off.|
| handler | Function \| string | Yes| Function to be called repeatedly.|
| delay | number | Yes| Number of milliseconds delayed before the execution.|
| ...arguments | Array&lt;any&gt; | No| Additional parameters to pass to the handler after the timer goes off.|
**Return value**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册