Skip to content

Commit

Permalink
Fix timezone format for song duration (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
siper authored Aug 25, 2024
1 parent 700cf92 commit dd95384
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/utils/src/main/java/ru/stersh/youamp/core/utils/Time.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ package ru.stersh.youamp.core.utils

import java.text.SimpleDateFormat
import java.util.Date
import java.util.TimeZone

private const val ONE_HOUR_MS = 3600000L
private val minuteTimeFormat = SimpleDateFormat("mm:ss")
private val hourTimeFormat = SimpleDateFormat("hh:mm:ss")
private val utcTimeZone = TimeZone.getTimeZone("UTC")
private val minuteTimeFormat = SimpleDateFormat("mm:ss").apply {
timeZone = utcTimeZone
}
private val hourTimeFormat = SimpleDateFormat("hh:mm:ss").apply {
timeZone = utcTimeZone
}

fun formatSongDuration(time: Long): String {
return if (time >= ONE_HOUR_MS) {
Expand Down

0 comments on commit dd95384

Please sign in to comment.