• Home
Name Date Size #Lines LOC

..--

entry/12-May-2024-378319

screenshots/device/12-May-2024-

.gitignoreD12-May-2024121 88

README.mdD12-May-2024496 178

README_zh.mdD12-May-20241.4 KiB3216

build-profile.json5D12-May-20241.1 KiB4341

hvigorfile.jsD12-May-2024175 21

package.jsonD12-May-2024384 1918

README.md

1# Setting the Timer and System Time
2
3### Introduction
4
5This sample shows how to use the **systemTime** and **setTimeout()** APIs to set the system time and timer.
6
7### Usage
8
9Touch the time picker, select a date and time, and touch the corresponding button to set the system time.
10
11Touch the countdown box, select the timer duration, and touch the button to start the timer. To cancel the timer, touch the cancel button.
12
13### Constraints
14
15This sample can only be run on standard-system devices.
16
17

README_zh.md

1# 定时器与系统时间设置
2
3### 简介
4
5本示例通过 systemTime 接口来实现设置系统时间,通过 setTimeout() 等函数来设置定时器。
6
7实现效果如下:
8
9![](screenshots/device/screen.png)
10
11### 相关概念
12
13设置系统时间:本模块主要由时间、时区和定时三大功能组成。其中,定时服务用来管理和使用时间、时区。开发者可以通过对系统进行设置、获取等操作管理系统时间、时区,也可以通过定时功能实现定时服务如闹钟服务等。
14
15### 相关权限
16
17设置系统时间权限:ohos.permission.SET_TIME
18
19### 使用说明
20
211.点击**时间框**,选择时间日期,点击相应按钮来设置系统时间。
22
232.点击**倒计时框**,选择定时器的时长,点击**按钮**来启动定时器,若想中途放弃定时任务,点击**取消**按钮。
24
25### 约束与限制
26
271.本示例仅支持在标准系统上运行。
28
292.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。
30
313.本示例所配置的权限ohos.permission.SET_TIME为system_basic级别(相关权限级别可通过[权限定义列表](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md)查看),需要手动配置对应级别的权限签名(具体操作可查看[自动化签名方案](https://docs.openharmony.cn/pages/v3.2Beta/zh-cn/application-dev/security/hapsigntool-overview.md/))32