Skip to content

Commit

Permalink
fix: pause wrong epg timestamp zone.
Browse files Browse the repository at this point in the history
  • Loading branch information
oxyroid committed Sep 6, 2024
1 parent 750f796 commit af074ea
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions data/src/main/java/com/m3u/data/parser/epg/EpgData.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package com.m3u.data.parser.epg

import com.m3u.data.database.model.Programme
import kotlinx.datetime.TimeZone
import kotlinx.datetime.toInstant
import kotlinx.datetime.toKotlinLocalDateTime
import java.time.LocalDateTime
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatterBuilder

data class EpgProgramme(
Expand All @@ -19,19 +16,17 @@ data class EpgProgramme(
val categories: List<String>
) {
companion object {
fun readEpochMilliseconds(time: String): Long = LocalDateTime
fun readEpochMilliseconds(time: String): Long = ZonedDateTime
.parse(time, EPG_DATE_TIME_FORMATTER)
.toKotlinLocalDateTime()
.toInstant(TimeZone.UTC)
.toEpochMilliseconds()
.toInstant()
.toEpochMilli()

private val EPG_DATE_TIME_FORMATTER = DateTimeFormatterBuilder()
.appendPattern("yyyyMMddHHmmss")
.optionalStart()
.appendPattern(" Z")
.optionalEnd()
.toFormatter()
// .withZone(ZoneId.of("GMT"))
}
}

Expand Down

0 comments on commit af074ea

Please sign in to comment.