Skip to content

Commit

Permalink
update fw update time to match fix
Browse files Browse the repository at this point in the history
  • Loading branch information
crc-32 committed Nov 29, 2024
1 parent 4df8d9a commit 3ac7b52
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import timber.log.Timber
import java.io.InputStream
import java.util.TimeZone
import javax.inject.Inject
import kotlin.time.Duration.Companion.milliseconds

class FirmwareUpdateControlFlutterBridge @Inject constructor(
bridgeLifecycleController: BridgeLifecycleController,
Expand Down Expand Up @@ -77,11 +78,12 @@ class FirmwareUpdateControlFlutterBridge @Inject constructor(

private suspend fun sendTime() {
val timezone = TimeZone.getDefault()
val now = System.currentTimeMillis()
val now = System.currentTimeMillis().milliseconds.inWholeSeconds
val offsetMinutes = timezone.getOffset(now).milliseconds.inWholeMinutes

val updateTimePacket = TimeMessage.SetUTC(
(now / 1000).toUInt(),
timezone.getOffset(now).toShort(),
now.toUInt(),
offsetMinutes.toShort(),
timezone.id
)

Expand Down

0 comments on commit 3ac7b52

Please sign in to comment.