Skip to content

Commit

Permalink
Refactor clock methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluchu committed Jun 14, 2024
1 parent 4abc9bb commit 77b3bb8
Showing 1 changed file with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,35 @@ import java.util.Calendar
*/

@Composable
fun minutesLeft(): String {
fun clock(): String {
var time by rememberMutableStateOf(currentTime())

LaunchedEffect(0) {
while (true) {
time = currentTime()
delay(1000)
}
}

return "${time.hours}:${time.minutes}"
}

@Composable
fun clockTime(): Time {
var time by rememberMutableStateOf(currentTime())

LaunchedEffect(0) {
while (true) {
time = currentTime()
delay(1000)
}
}

return time
}

@Composable
fun clockWithZoneDay(): String {
var time by rememberMutableStateOf(currentTime())

LaunchedEffect(0) {
Expand Down

0 comments on commit 77b3bb8

Please sign in to comment.