Read the clock in the reader's zone on Android too
The zone chain had two branches and Android satisfies neither: it sets no TZ, and it has no /etc/localtime to point at or read the bytes of. Both came up empty, so the APK fell through to UTC and read every channel seven hours ahead of the phone's own clock — the same fault as the container case, reached by a different route. Android keeps the zone in a system property instead. It is a plain zone name, which bionic resolves against its own tzdata just as glibc does against /usr/share/zoneinfo, so the offset stays DST-correct per instant rather than fixed. The exec is reachable from inside the app sandbox; SELinux does not stand in the way of getprop. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0daacbb parent: bffe879 modified
src/frq/clock.jolt +9 -0 | @@ -31,6 +31,15 @@ | ||
| 31 | 31 | (str/trim (str (host/sh-out "readlink -f /etc/localtime"))))) |
| 32 | 32 | (catch Exception _ nil)) |
| 33 | 33 | (when (host/file-exists? "/etc/localtime") ":/etc/localtime") |
| 34 | + ;; Android has neither: no TZ in the environment and no /etc/localtime | |
| 35 | + ;; to point at or read, so both branches above come up empty and the | |
| 36 | + ;; APK read every channel in UTC. The zone is a system property there, | |
| 37 | + ;; and bionic resolves the name against its own tzdata just as glibc | |
| 38 | + ;; resolves it against /usr/share/zoneinfo — so the name is all we need. | |
| 39 | + (try | |
| 40 | + (let [tz (str/trim (str (host/sh-out "getprop persist.sys.timezone")))] | |
| 41 | + (when (seq tz) tz)) | |
| 42 | + (catch Exception _ nil)) | |
| 34 | 43 | "UTC"))) |
| 35 | 44 | |
| 36 | 45 | (defn now-ms [] (quot (host/wall-nanos) 1000000)) |
| @@ -31,6 +31,15 @@ | |||
| 31 | (str/trim (str (host/sh-out "readlink -f /etc/localtime"))))) | 31 | (str/trim (str (host/sh-out "readlink -f /etc/localtime"))))) |
| 32 | (catch Exception _ nil)) | 32 | (catch Exception _ nil)) |
| 33 | (when (host/file-exists? "/etc/localtime") ":/etc/localtime") | 33 | (when (host/file-exists? "/etc/localtime") ":/etc/localtime") |
| 34 | + ;; Android has neither: no TZ in the environment and no /etc/localtime | ||
| 35 | + ;; to point at or read, so both branches above come up empty and the | ||
| 36 | + ;; APK read every channel in UTC. The zone is a system property there, | ||
| 37 | + ;; and bionic resolves the name against its own tzdata just as glibc | ||
| 38 | + ;; resolves it against /usr/share/zoneinfo — so the name is all we need. | ||
| 39 | + (try | ||
| 40 | + (let [tz (str/trim (str (host/sh-out "getprop persist.sys.timezone")))] | ||
| 41 | + (when (seq tz) tz)) | ||
| 42 | + (catch Exception _ nil)) | ||
| 34 | "UTC"))) | 43 | "UTC"))) |
| 35 | 44 | ||
| 36 | (defn now-ms [] (quot (host/wall-nanos) 1000000)) | 45 | (defn now-ms [] (quot (host/wall-nanos) 1000000)) |