/**
* 定时器
*/
@Composable
fun time() {
var timer : Timer? =null
val sdf = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
timer = Timer()
var number by remember {
mutableStateOf(sdf.format(Date()))
}
LaunchedEffect(key1 = number , block = {
timer!!.schedule(object : TimerTask() {
override fun run() {
// 时间
number = sdf.format(Date())
}
}, 0, 1000)
})
Text(text = number)
}