Dates, times and territories
Chris Hall (132) 3554 posts |
Let us say that RISC OS is examining a GPS track which includes latitude, longitude and, in UTC/GMT the date and time. This is how the GPX format records location and time. How does it work out which time zone the track was recorded in so that it displays the correct local time of when the route was created? An example is a track recorded from Bristol to Bewdley in mid March 2021 when the time zone was GMT but is being displayed now, when the time zone is BST. The journey was from 0830 to 0945 but would appear (without juggling) as 0930 to 1045. In principle latitude and longitude gives location and hence time zone GMT Oct to Mar; BST Mar to Oct. |
David J. Ruck (33) 1635 posts |
You need to work out the local time offset from UTC on the date of the reading rather than the current date, so you only apply DST corrections when they are in force. |
Chris Hall (132) 3554 posts |
Yes. I don’t know how RISC OS works out the local time offset from the date then, the date now, the location then (from lat and long) and the location now (from territory module?). I did not want to assume that we would always be in England. |
David J. Ruck (33) 1635 posts |
Territory_DaylightSaving SWI with Apply DST rule to UTC ordinals, would seem to be what you want. I’ve not used it myself, and have no idea how widely it is supported in different territories. |
Rick Murray (539) 13840 posts |
It doesn’t. Because of the shonky design of the Territory system, it will depend upon the software processing the GPS track to convert the location to a country, to then look up what sort of timezones are in use there, to then correlate that with the date to see what the appropriate time should be. RISC OS has no facilities for converting a grid reference of any form to a physical location (and therein lies a world of politics – from Israel/Palestine to the fact that a lot of borders are extremely messy so one can’t just calculate a straight line from here to there). There are online geocoding lookups, but they need an API key (and possibly a subscription). RISC OS does have facilities to return the change dates of when summer time begins and ends at any given territory, provided that you have an appropriate territory loaded on your machine. I believe there’s a call to convert a UTC time appropriately, but the same caveat as before. There’s a reason I hacked my UK territory to include CET and CEST timezones, and there’s a reason why doing so brought to light a rather fundamental bug in CLib’s handling of such. I’ve written many longer (and less polite) messages about the mess that is Territory, about the unfounded assumptions it makes, and much more besides, so I won’t repeat all of that here. Suffice to say: regional customisation, language (and keyboard), and time handling are three things that are related but should not be baked into a ROM. Territory might have been a sort of solution in RISC OS 3. It is not fit for purpose and needs to be replaced with something more flexible and configurable. |
Steve Pampling (1551) 8170 posts |
Keyb… [retreat to corner and mutter things about Q-Anon…] |