Lines Matching refs:time

3 …module provides system time and time zone features. You can use the APIs of this module to set and…
7 … 9. You are advised to use [@ohos.systemDateTime (system time and time zone)](js-apis-date-time.md…
20 Obtains the time elapsed since the Unix epoch. This API uses an asynchronous callback to return the…
28 | isNano | boolean | Yes | Whether the time to return is in nanoseconds.<br>…
29 | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the time elapsed since th…
33 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
45 systemTime.getCurrentTime(true, (error: BusinessError, time: number) => {
50 console.info(`Succeeded in getting currentTime: ${time}`);
62 Obtains the time elapsed since the Unix epoch. This API uses an asynchronous callback to return the…
70 | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the time elapsed since th…
74 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
86 systemTime.getCurrentTime((error: BusinessError, time: number) => {
91 console.info(`Succeeded in getting currentTime : ${time}`);
103 Obtains the time elapsed since the Unix epoch. This API uses a promise to return the result.
111 | isNano | boolean | No | Whether the time to return is in nanoseconds. The default value is **fal…
117 | Promise&lt;number&gt; | Promise used to return the time elapsed since the Unix epoch.|
121 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
133 systemTime.getCurrentTime().then((time: number) => {
134 console.info(`Succeeded in getting currentTime : ${time}`);
148 Obtains the time elapsed since system startup, excluding the deep sleep time. This API uses an asyn…
156 | isNano | boolean | Yes | Whether the time to return is in nanoseconds.<br>…
157 | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the time.|
161 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
173 systemTime.getRealActiveTime(true, (error: BusinessError, time: number) => {
175 …console.info(`Failed to getting real active time. message: ${error.message}, code: ${error.code}`);
178 console.info(`Succeeded in getting real active time : ${time}`);
182 console.info(`Failed to get real active time. message: ${error.message}, code: ${error.code}`);
190 Obtains the time elapsed since system startup, excluding the deep sleep time. This API uses an asyn…
198 | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the time.|
202 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
214 systemTime.getRealActiveTime((error: BusinessError, time: number) => {
216 …console.info(`Failed to getting real active time. message: ${error.message}, code: ${error.code}`);
219 console.info(`Succeeded in getting real active time : ${time}`);
223 console.info(`Failed to get real active time. message: ${error.message}, code: ${error.code}`);
231 Obtains the time elapsed since system startup, excluding the deep sleep time. This API uses a promi…
239 | isNano | boolean | No | Whether the time to return is in nanoseconds. The default value is **fal…
245 …&lt;number&gt; | Promise used to return the time elapsed since system startup, excluding the deep …
249 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
261 systemTime.getRealActiveTime().then((time: number) => {
262 console.info(`Succeeded in getting real active time : ${time}`);
264 …console.info(`Failed to getting real active time. message: ${error.message}, code: ${error.code}`);
268 console.info(`Failed to get real active time. message: ${error.message}, code: ${error.code}`);
276 Obtains the time elapsed since system startup, including the deep sleep time. This API uses an asyn…
284 | isNano | boolean | Yes | Whether the time to return is in nanoseconds.<br>…
285 | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the time. |
289 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
301 systemTime.getRealTime(true, (error: BusinessError, time: number) => {
303 console.info(`Failed to getting real time. message: ${error.message}, code: ${error.code}`);
306 console.info(`Succeeded in getting real time : ${time}`);
310 console.info(`Failed to get real time. message: ${error.message}, code: ${error.code}`);
318 Obtains the time elapsed since system startup, including the deep sleep time. This API uses an asyn…
326 | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the time. |
330 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
342 systemTime.getRealTime((error: BusinessError, time: number) => {
344 console.info(`Failed to getting real time. message: ${error.message}, code: ${error.code}`);
347 console.info(`Succeeded in getting real time : ${time}`);
351 console.info(`Failed to get real time. message: ${error.message}, code: ${error.code}`);
359 Obtains the time elapsed since system startup, including the deep sleep time. This API uses a promi…
367 | isNano | boolean | No | Whether the time to return is in nanoseconds. The default value is **fal…
373 …&lt;number&gt; | Promise used to return the time elapsed since system startup, including the deep …
377 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
389 systemTime.getRealTime().then((time: number) => {
390 console.info(`Succeeded in getting real time : ${time}`);
392 console.info(`Failed to getting real time. message: ${error.message}, code: ${error.code}`);
396 console.info(`Failed to get real time. message: ${error.message}, code: ${error.code}`);
416 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
457 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
484 Obtains the system time zone. This API uses an asynchronous callback to return the result.
492 … Callback used to return the system time zone. For details, see [Supported System Time Zones](#sup…
496 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
525 Obtains the system time zone. This API uses a promise to return the result.
533 …| Promise used to return the system time zone. For details, see [Supported System Time Zones](#sup…
537 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
562 setTime(time : number, callback : AsyncCallback&lt;void&gt;) : void
564 Sets the system time. This API uses an asynchronous callback to return the result.
574 | time | number | Yes | Timestamp to set, in milliseconds. …
579 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
590 // Set the system time to 2021-01-20 02:36:25.
591 let time = 1611081385000;
593 systemTime.setTime(time, (error: BusinessError) => {
595 console.info(`Failed to setting time. message: ${error.message}, code: ${error.code}`);
598 console.info(`Succeeded in setting time`);
602 console.info(`Failed to set time. message: ${error.message}, code: ${error.code}`);
608 setTime(time : number) : Promise&lt;void&gt;
610 Sets the system time. This API uses a promise to return the result.
620 | time | number | Yes | Timestamp to set, in milliseconds.|
630 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
641 // Set the system time to 2021-01-20 02:36:25.
642 let time = 1611081385000;
644 systemTime.setTime(time).then(() => {
645 console.info(`Succeeded in setting time.`);
647 console.info(`Failed to setting time. message: ${error.message}, code: ${error.code}`);
651 console.info(`Failed to set time. message: ${error.message}, code: ${error.code}`);
674 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
724 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
752 Sets the system time zone. This API uses an asynchronous callback to return the result.
762 … | Yes | System time zone to set. For details, see [Supported System Time Zones](…
767 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
796 Sets the system time zone. This API uses a promise to return the result.
806 …imezone | string | Yes | System time zone to set. For details, see [Supported System Time Zones](…
816 For details about the error codes, see [Time and Time Zone Service Error Codes](./errorcode-time.md…
841 …ing table lists the supported system time zones and the respective offset (unit: h) between each t…