Skip to content

Conversation

TTRR1007
Copy link

@TTRR1007 TTRR1007 commented Jul 7, 2025

김영수 11주차 과제 제출입니다

delay 단독 사용할 경우에 실제 시간과 다르게 스톱워치에 지연이 생길 수 있다고 하신걸 System.currentTimeMillis()을 이용해서 현재 시간과 시작 시간의 차이를 나타내어 봤습니다.
이 방법 외에도 handler나 기본으로 제공하는 timer 기능이 있는 것 같은데, 혹시 어느 방법이 가장 정석적인 방법인지 궁금합니다.

Copy link
Contributor

@kongwoojin kongwoojin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다.
질문 주신 부분은 상황에 따라 달라질 것 같네요
일단 현재 코인에서는 Thread를 사용한 방법을 주로 사용합니다.
다만, 이번 과제는 Coroutine을 이용해서 타이머를 구현하는 것이기 때문에 구현해주신 방법이 가장 정석적인 방법입니다.

저 같은 경우 비기너 시절에 한번의 루프에서 발생한 오차를 다름 루프에서 보정하는 방식으로 코드를 작성했었는데, 제출하신 과제가 더 좋은 방법으로 보이네요

}
}

private fun formatTime(ms: Long): String {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확장함수를 활용하면 좋을 것 같네요

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants