Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,20 @@ class SystemHandler(
val timezone = TimeZone.currentSystemDefault()
val now = Clock.System.now()
val timezoneOffsetMinutes = timezone.offsetAt(now).totalSeconds.seconds.inWholeMinutes
Logging.i("Sending current time to watch: $now, timezone: ${timezone.id} (truncated: ${timezone.id.take(MAX_TIMEZONE_NAME_LENGTH)}), offset: $timezoneOffsetMinutes")

val normalizedZone = timezone.id
if (normalizedZone.length > MAX_TIMEZONE_NAME_LENGTH) {
normalizedZone = normalizedZone.take(MAX_TIMEZONE_NAME_LENGTH)
Logging.i("Time Zone ${timezone.id} exceeds maximum value length and has been truncated to ${normalizedZone}")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this truncation

  1. is a recent addition - a436039
  2. most likely is an edge case

I felt it was worth being noisy about it in this separate log, instead of trying to shoehorn it into the existing log.

}

val updateTimePacket = TimeMessage.SetUTC(
now.epochSeconds.toUInt(),
timezoneOffsetMinutes.toShort(),
timezone.id.take(MAX_TIMEZONE_NAME_LENGTH)
normalizedZone
)

Logging.i("Sending current time to watch: $now, timezone: ${normalizedZone}, offset: $timezoneOffsetMinutes")
Copy link
Contributor Author

@jhoule86 jhoule86 Feb 9, 2025

Choose a reason for hiding this comment

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

Moving the log down to this line is admittedly trivial, but I felt that it helped the flow of the code, and prepares for the potential change to
Logging.i("Sending current time to watch: ${updateTimePacket}")
if/when there is a good toString implemented.

systemService.send(updateTimePacket)
}

Expand Down Expand Up @@ -162,4 +169,4 @@ class SystemHandler(
}

expect fun platformTimeChangedFlow(context: PlatformContext): Flow<Unit>
expect fun getPlatformPebbleFlags(context: PlatformContext): Set<PhoneAppVersion.PlatformFlag>
expect fun getPlatformPebbleFlags(context: PlatformContext): Set<PhoneAppVersion.PlatformFlag>
Loading