feat(worldclock): show local time automatically while travelling

Issue #24 asks for Google Clock's "automatic home clock": a temporary
Home row while the device is somewhere the time differs from home. In
Google Clock that works because the hero clock is local time. Clockula
is the other way round: the hero face is home (the stored home zone, or
the device's zone when none is stored), every row is read against home,
and with a stored home the face already shows home time on a trip. A
Home row would only repeat the face; what goes missing while travelling
is the local time.

So the feature is turned round. With a home zone stored and the device's
zone on a different UTC offset right now, the tab shows the device's
zone as a temporary "Local time" row between the face and the saved
cities. It is never stored, sits outside the reorderable column, has no
move or remove actions and does not count towards the 24-city cap. The
comparison is the current UTC offset, as Google's is, so Paris with
home in Berlin shows nothing. The row is hidden when a saved city is
already on the device's offset. It is rebuilt on every tick from the
same device-zone read the face uses, so it appears and disappears
within a tick of a time-zone change while the tab is open.

Home that follows the device can never differ from it. Settings > Clock
gets an "Automatic local clock" switch (on by default) under the home
zone row; while home follows the device the row is dimmed and its hint
says it needs a home time zone. The switch is stored as
automatic_local_clock and included in backups. Files written before this
change restore it as on.

Fixes #24
This commit is contained in:
makiolaj committed 2026-10-21 20:06:13 +02:00
1 parent 3f431a7f32
commit f5388042c6
20 files changed
+445 -12

No files matched your search

+5
View File
@@ -220,6 +220,8 @@
<string name="world_clock_limit">Add up to %1$d cities</string>
<string name="world_clock_home_action">Home time zone</string>
<string name="world_clock_home">Home</string>
<!-- #24: labels the temporary row for the device's own time zone while it differs from home. -->
<string name="world_clock_local">Local time</string>
<string name="world_clock_empty_hint">Add a city to compare its time with your own.</string>
<string name="world_clock_offset_same">Same time as home</string>
<string name="world_clock_ahead">%1$s ahead</string>
@@ -304,6 +306,9 @@
<string name="settings_clock_subtitle">Home time zone</string>
<string name="settings_clock_hint">World clocks show how far each city is from your home time zone.</string>
<string name="settings_home_zone">Home time zone</string>
<string name="settings_automatic_local_clock">Automatic local clock</string>
<string name="settings_automatic_local_clock_hint">While you’re somewhere the time differs from home, show the local time under the home clock.</string>
<string name="settings_automatic_local_clock_needs_home">Needs a home time zone. Home follows the device now, so it’s always local time.</string>
<string name="settings_self_check">Why might my alarm not ring?</string>
<string name="settings_self_check_title">Why might my alarm not ring?</string>
<string name="settings_self_check_summary">Check exact-alarm, notification and battery settings</string>