Rick's b.log - 2014/07/20 |
|
It is the 24th of November 2024 You are 3.144.6.29, pleased to meet you! |
|
mailto:
blog -at- heyrick -dot- eu
So the first thing I did was go on the forums and moan. That's what the internet is for, right?
Then I decided to look and see if I could paste support for CET and CEST into the UK territory:
So I could do this:
The stupid thing still couldn't tell me the correct time.
Turns out that - regardless of some of the opinions in the forum - Territory is actually quite capable of handling arbitrary timezone offsets. This particular fault was not with Territory. This particular fault was best experienced by looking at the code for C's localtime() function:
Ah. So now we're getting somewhere. Here is what the PRM says for that system call:
At any rate, this means that localtime() absolutely cannot work in a multi-zone territory where the configured zone is not the first; and looking back through the CVS change history, I don't think that it has ever worked correctly.
The biggest pile of nonsense is that Territory actually provides a call to do just exactly what we want:
So, localtime() is now modified as such:
The behaviour for named zones is retained. For us using the default C locale? We just ask what the offset is. No munging, no nothing. Territory has already sussed all of that.
New ROM built, installed, and tested with UK-with-CEST and various US timezones. Works fine.
Phew! What an adventure!
Fixing RISC OS's CLib
My adventure started with this little bit of code:
Try as I might, it told me the time according to British Summer Time.
The system call Territory_ReadTimeZones is called to read the offset, which is then bodged according to the DST flag.
A ticket has been opened, corrective modifications have been sent to ROOL, so hopefully soon localtime() will work for everybody.
No comments yet...
© 2014 Rick Murray |
This web page is licenced for your personal, private, non-commercial use only. No automated processing by advertising systems is permitted. RIPA notice: No consent is given for interception of page transmission. |