<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">How does that work at the user level? I have an Android 10 phone (build<br>QQ1A.200105.032), and couldn't see these UI options under either<br>"Settings>System>Date & time>Time zone" or "Clock>⋮>Settings>Home time zone"<br>(these have different UIs).<br></blockquote><div><br></div><div><div>Partners are free to replace / modify settings up to a point, but even in the stock code the support for fixed offsets is *not* very obvious. This is partly by design as it's a niche use case. In the top right corner usually there's a menu button with a single item: "Select by UTC offset" which puts the settings picker into a different mode.</div><div></div></div><div><br></div><div>It's the Settings that is considered part of the Android platform (where I work). The Clock app is an app that operates on many versions of Android and can be updated independently. As far as I know relies on the TZDB rules provided by the platform but it ships with a list of the more common zones, not a comprehensive list.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">In GNU/Linux the way to solve this problem is to use a TZ setting like<br>TZ='<+0545>-5:45' for Nepal (or TZ='NPT-5:45' for older POSIX). Does this work<br>for Android? If so, I suggest going that way. If not, perhaps POSIX TZ support<br>should be added to Android; that shouldn't be hard, and would improve<br>functionality and compatibility in other areas too. If it couldn't be done for<br>Android it could at least be done for the Clock app.<br></blockquote><div><br></div><div>I know that wouldn't work today. I'm sorry to say it would also probably be quite a lot more work than adding new entries to TZDB. The odds of Android consistently supporting the newer POSIX free-form any time soon are probably low. I'll try to explain...<br></div><div><br></div><div>In short, this is because Android uses a combination of various open source libraries. There are a lot of history / compatibility considerations. i.e. all the parts agree on what the TZDB identifiers mean, but probably not more than that. I've seen a few pieces of fallback logic that first try to treat a string as a TZDB identifier before falling back to other parsing (but which differ). There's the extra dimension that 3rd party apps may also be reading this information, and so existing apps and they libraries they use may break when confronted with something in the form '<+0545>-5:45' when they're expecting a TZDB identifier, or conform to an older POSIX spec.</div><div><br></div><div><div>I know support for non-TZDB identifiers was explicitly removed before I started working on Android. For example [3]:</div><div><br></div><div><div style="margin:0px;padding:0px;box-sizing:border-box;border-color:rgba(0,0,0,0.12);color:rgb(0,0,0);font-family:monospace;font-size:medium;white-space:pre"><span class="gmail-cm-comment" style="margin:0px;padding:0px;box-sizing:border-box;border-color:rgba(0,0,0,0.12);color:rgb(136,0,0)">     * <p> On android M and above, it is an error to pass in a non-Olson timezone to this</span>
</div><div style="margin:0px;padding:0px;box-sizing:border-box;border-color:rgba(0,0,0,0.12);color:rgb(0,0,0);font-family:monospace;font-size:medium;white-space:pre"><span class="gmail-cm-comment" style="margin:0px;padding:0px;box-sizing:border-box;border-color:rgba(0,0,0,0.12);color:rgb(136,0,0)">     * function. Note that this is a bad idea on all Android releases because POSIX and</span>
</div><div style="margin:0px;padding:0px;box-sizing:border-box;border-color:rgba(0,0,0,0.12);color:rgb(0,0,0);font-family:monospace;font-size:medium;white-space:pre"><span class="gmail-cm-comment" style="margin:0px;padding:0px;box-sizing:border-box;border-color:rgba(0,0,0,0.12);color:rgb(136,0,0)">     * the {@code TimeZone} class have opposite interpretations of {@code '+'} and {@code '-'}</span>
</div><div style="margin:0px;padding:0px;box-sizing:border-box;border-color:rgba(0,0,0,0.12);color:rgb(0,0,0);font-family:monospace;font-size:medium;white-space:pre"><span class="gmail-cm-comment" style="margin:0px;padding:0px;box-sizing:border-box;border-color:rgba(0,0,0,0.12);color:rgb(136,0,0)">     * in the same non-Olson ID.</span>
</div></div></div><div><br></div><div>To be honest, just adding new "Etc/GMT-5:30" identifiers could also cause problems (not just for Android), but it seems likely it could be made to work without too much effort on the Android side. Even if there was enthusiasm here, I would want to try it out and would need to consider the effect on older releases of Android in case the colon character broke something, or a widely used app out there would try to parse anything after "GMT" as an integer!</div><div><br></div><div><div>Just for completeness: Android does not primarily use the TZ environment variable: components like our libc and managed code have been altered to refer to Android's system property libraries, which ensures that all long-running programs are informed via events (AKA Intents on Android) when the value changes. This ensures that the UI updates and that the various APIs we expose to apps return a consistent answer regardless of when the process started. This is similar to what happens when the user changes their preferred language settings.<br></div><div><br></div></div><div>Neil.</div><div><br></div><div>[3] <a href="https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/app/AlarmManager.java#982">https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/core/java/android/app/AlarmManager.java#982</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 21 Oct 2020 at 18:50, Paul Eggert <<a href="mailto:eggert@cs.ucla.edu">eggert@cs.ucla.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 10/21/20 10:12 AM, Neil Fuller via tz wrote:<br>
> The Stock Android settings UI, starting with Android Pie (9.0), allows<br>
> users to select from the fixed "Etc/GMT-5" style identifiers from TZDB<br>
<br>
How does that work at the user level? I have an Android 10 phone (build <br>
QQ1A.200105.032), and couldn't see these UI options under either <br>
"Settings>System>Date & time>Time zone" or "Clock>⋮>Settings>Home time zone" <br>
(these have different UIs).<br>
<br>
> The current Etc/GMT[+-] zone identifiers in TZDB only cover whole hour<br>
> offsets. There are various places that use 30 minute offsets, and a few<br>
> that use 45/15 minute offsets [2].<br>
<br>
I suppose we could add IDs for non-hour offsets currently in use. I worry, <br>
though, that there will be more odd offsets outside the civil-aviation <br>
application area, such as the offsets that various astronomical observatories <br>
use (as Steve Allen mentioned).<br>
<br>
In GNU/Linux the way to solve this problem is to use a TZ setting like <br>
TZ='<+0545>-5:45' for Nepal (or TZ='NPT-5:45' for older POSIX). Does this work <br>
for Android? If so, I suggest going that way. If not, perhaps POSIX TZ support <br>
should be added to Android; that shouldn't be hard, and would improve <br>
functionality and compatibility in other areas too. If it couldn't be done for <br>
Android it could at least be done for the Clock app.<br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Google UK Limited<br><br>Registered Office: 6 Pancras Square, London, N1C 4AG<br>Registered in England Number: 3977902</div></div></div></div></div>