> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
## Modules to Import
...
...
@@ -40,16 +40,18 @@ Obtains an [InputMethodController](#InputMethodController) instance.
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
## Modules to Import
```
import systemTime from '@ohos.systemTime';
```
...
...
@@ -22,16 +22,17 @@ Sets the system time. This API uses an asynchronous callback to return the resul
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
**Parameters**
- Example
```
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
**Example**
```js
systemTime.getCurrentTime(true,(error,data)=>{
if(error){
console.error(`failed to systemTime.getCurrentTime because `+JSON.stringify(error));
...
...
@@ -111,19 +115,21 @@ Obtains the time elapsed since the Unix epoch. This API uses a promise to return
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
**Parameters**
- Return value
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the time.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
- Example
```
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the time.|
**Example**
```js
systemTime.getCurrentTime().then((data)=>{
console.log(`systemTime.getCurrentTime success data : `+JSON.stringify(data));
}).catch((error)=>{
...
...
@@ -140,15 +146,16 @@ Obtains the time elapsed since system start, excluding the deep sleep time. This
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
**Parameters**
- Example
```
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
**Example**
```js
systemTime.getRealActiveTime(true,(error,data)=>{
if(error){
console.error(`failed to systemTime.getRealActiveTimebecause `+JSON.stringify(error));
...
...
@@ -167,19 +174,21 @@ Obtains the time elapsed since system start, excluding the deep sleep time. This
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
**Parameters**
- Return value
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the time.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
- Example
```
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the time.|
**Example**
```js
systemTime.getCurrentTime().then((data)=>{
console.log(`systemTime.getRealActiveTime success data : `+JSON.stringify(data));
}).catch((error)=>{
...
...
@@ -196,15 +205,16 @@ Obtains the time elapsed since system start, including the deep sleep time. This
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
**Parameters**
- Example
```
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
| callback | AsyncCallback<number> | Yes| Callback used to return the time.|
**Example**
```js
systemTime.getRealTime(true,(error,data)=>{
if(error){
console.error(`failed to systemTime.getRealTime because `+JSON.stringify(error));
...
...
@@ -223,19 +233,21 @@ Obtains the time elapsed since system start, including the deep sleep time. This
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
**Parameters**
- Return value
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the time.|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| isNano | boolean | No| Whether nanoseconds or milliseconds will be returned. If the value is **true**, nanoseconds will be returned. Otherwise, milliseconds will be returned.|
- Example
```
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<number> | Promise used to return the time.|