localtime() is broken [might be Territory?]
Rick Murray (539) 13850 posts |
I will need to test the following combinations (if supported) to ensure that behaviour is no worse than before:
I do not have RISC OS 4.xx – so could somebody please test the library and programs? I have put together a mini test suite here containing the “fixed” library, plus the TimeFiddle program in various guises. How to test :
The output will be something like this: gmtime() says : Mon Apr 25 20:48:07 2016 localtime() says : Mon Apr 25 22:48:07 2016 The first line will be the time in UTC, the second will be the time in your local time (+1 for most of you in BST; +2 for me in CEST).
I will perform the test on the following systems tomorrow or Wednesday:
So, if anybody can fill in with RISC OS 4.xx, that would be a great help. |
||||||||||||||
Rick Murray (539) 13850 posts |
Since Jeffrey has built a good 26 bit safe version, I’ll give it a whirl on !A310Emu as well, just, you know, for the lulz. ;-) If you encounter any problems with my CLib2632, try Jeffrey’s build.
The archaic version of the compiler was not for CLib, it was for something capable of building APCS-R software to run natively on older versions of RISC OS using the ROM CLib… Thanks for the library. |
||||||||||||||
Rick Murray (539) 13850 posts |
WARNING – long post follows. Edit Billion-1: B*^&%y Textile…! Order of tests:
In these tests:
All machines tested were emulated. RISC OS 3.10Tested on an A310 emulator running within a RiscPC emulator. Can you say slow!?!? ;-) *Help UtilityModule ==> Help on keyword UtilityModule Module is: MOS Utilities 3.11 (29 Sep 1992) Commands provided: Configure Echo Error Eval GOS IF Ignore Modules RMClear RMEnsure RMFaster RMInsert RMKill RMLoad RMReInit RMRun RMTidy ROMModules Set SetEval SetMacro Show Status Time Unplug Unset It has help on: Break Commands FileCommands PowerOn Reset Syntax *Help SharedCLibrary ==> Help on keyword SharedCLibrary Module is: C Library 3.99 (23 Apr 1992) *Configure GMT *Configure Timezone 0 *Time Fri,26 Apr 1996.20:25:56 *TF-APCSR gmtime() says : Fri Apr 26 20:26:04 1996 localtime() says : Fri Apr 26 20:26:04 1996 *TF-APCSN Shared C library is out of date *Configure BST *TF-APCSR gmtime() says : Fri Apr 26 20:26:15 1996 localtime() says : Fri Apr 26 21:26:15 1996 *Configure GMT *RMLoad CallASWI *RMLoad CLibJ *Help SharedCLibrary ==> Help on keyword SharedCLibrary Module is: C Library 5.88 (29 Feb 2016) *TF-APCSR gmtime() says : Fri Apr 26 20:26:45 1996 localtime() says : Fri Apr 26 20:26:45 1996 *TF-APCSN gmtime() says : Fri Apr 26 20:26:48 1996 localtime() says : Fri Apr 26 20:26:48 1996 *TF-APCS32 gmtime() says : Fri Apr 26 20:26:52 1996 localtime() says : Fri Apr 26 20:26:52 1996 *Configure BST *TF-APCSR gmtime() says : Fri Apr 26 20:27:03 1996 localtime() says : Fri Apr 26 21:27:03 1996 *TF-APCSN gmtime() says : Fri Apr 26 20:27:06 1996 localtime() says : Fri Apr 26 21:27:06 1996 *TF-APCS32 gmtime() says : Fri Apr 26 20:27:09 1996 localtime() says : Fri Apr 26 21:27:09 1996 * Result: No change (success) RISC OS 3.50I have added a Timezone +4 (plus DST) at the very end, just to observe the behaviour on localtime. 19h → 00h is as expected. This has only been done the once. No reason to believe anything is otherwise different. *Dir CLibTest *Help UtilityModule ==> Help on keyword UtilityModule Module is: MOS Utilities 3.50 (18 Feb 1994) Commands provided: Configure Echo Error Eval GOS IF Ignore Modules RMClear RMEnsure RMFaster RMInsert RMKill RMLoad RMReInit RMRun RMTidy ROMModules Set SetEval SetMacro Show Status Time Unplug Unset It has help on: Break Commands FileCommands PowerOn Reset Syntax *Help SharedCLibrary ==> Help on keyword SharedCLibrary Module is: C Library 4.58 (10 Feb 1994) *Configure GMT *Configure Timezone 0 *TF-APCSR gmtime() says : Tue Apr 26 19:11:26 2016 localtime() says : Tue Apr 26 19:11:26 2016 *TF-APCSN Error: Shared C library is out of date (Error Number &800E91) *Configure BST *TF-APCSR gmtime() says : Tue Apr 26 19:11:46 2016 localtime() says : Tue Apr 26 20:11:46 2016 *Configure GMT *RMLoad CallASWI *RMLoad CLibJ *Help SharedCLibrary ==> Help on keyword SharedCLibrary Module is: C Library 5.88 (29 Feb 2016) *TF-APCSR gmtime() says : Tue Apr 26 19:12:24 2016 localtime() says : Tue Apr 26 19:12:24 2016 *TF-APCSN gmtime() says : Tue Apr 26 19:12:31 2016 localtime() says : Tue Apr 26 19:12:31 2016 *TF-APCS32 gmtime() says : Tue Apr 26 19:12:35 2016 localtime() says : Tue Apr 26 19:12:35 2016 *Configure BST *TF-APCSR gmtime() says : Tue Apr 26 19:12:46 2016 localtime() says : Tue Apr 26 20:12:46 2016 *TF-APCSN gmtime() says : Tue Apr 26 19:12:53 2016 localtime() says : Tue Apr 26 20:12:53 2016 *TF-APCS32 gmtime() says : Tue Apr 26 19:12:58 2016 localtime() says : Tue Apr 26 20:12:58 2016 *Configure Timezone +4 *TF-APCSR gmtime() says : Tue Apr 26 19:13:10 2016 localtime() says : Wed Apr 27 00:13:10 2016 *TF-APCSN gmtime() says : Tue Apr 26 19:13:15 2016 localtime() says : Wed Apr 27 00:13:15 2016 *TF-APCS32 gmtime() says : Tue Apr 26 19:13:20 2016 localtime() says : Wed Apr 27 00:13:20 2016 * Result: No change (success) RISC OS 3.60*Dir CLibTest *Help UtilityModule ==> Help on keyword UtilityModule Module is: MOS Utilities 3.60 (13 Apr 1995) Commands provided: Configure Echo Error Eval GOS IF Ignore Modules RMClear RMEnsure RMFaster RMInsert RMKill RMLoad RMReInit RMRun RMTidy ROMModules Set SetEval SetMacro Show Status Time Unplug Unset It has help on: Break Commands FileCommands PowerOn Reset Syntax *Help SharedCLibrary ==> Help on keyword SharedCLibrary Module is: C Library 4.79 (01 Mar 1995) *Configure GMT *Configure Timezone 0 *TF-APCSR gmtime() says : Tue Apr 26 19:15:24 2016 localtime() says : Tue Apr 26 19:15:24 2016 *TF-APCSN Error: Shared C library is out of date (Error number &800E91) *Configure BST *TF-APCSR gmtime() says : Tue Apr 26 19:15:42 2016 localtime() says : Tue Apr 26 20:15:42 2016 *Configure GMT *RMLoad CallASWI *RMLoad CLibJ *Help SharedCLibrary ==> Help on keyword SharedCLibrary Module is: C Library 5.88 (29 Feb 2016) *TF-APCSR gmtime() says : Tue Apr 26 19:16:16 2016 localtime() says : Tue Apr 26 19:16:16 2016 *TF-APCSN gmtime() says : Tue Apr 26 19:16:21 2016 localtime() says : Tue Apr 26 19:16:21 2016 *TF-APCS32 gmtime() says : Tue Apr 26 19:16:26 2016 localtime() says : Tue Apr 26 19:16:26 2016 *Configure BST *TF-APCSR gmtime() says : Tue Apr 26 19:16:34 2016 localtime() says : Tue Apr 26 20:16:34 2016 *TF-APCSN gmtime() says : Tue Apr 26 19:16:39 2016 localtime() says : Tue Apr 26 20:16:39 2016 *TF-APCS32 gmtime() says : Tue Apr 26 19:16:43 2016 localtime() says : Tue Apr 26 20:16:43 2016 * Result: No change (success) RISC OS 3.70*Dir CLibTest *Help UtilityModule ==> Help on keyword UtilityModule Module is: MOS Utilities 3.70 (30 Jul 1996) Commands provided: Configure Echo Error Eval GOS IF Ignore Modules RMClear RMEnsure RMFaster RMInsert RMKill RMLoad RMReInit RMRun RMTidy ROMModules Set SetEval SetMacro Show Status Time Unplug Unset It has help on: Break Commands FileCommands PowerOn Reset Syntax *Help SharedCLibrary ==> Help on keyword SharedCLibrary Module is: C Library 4.84 (04 Jul 1996) *Configure GMT *Configure Timezone 0 *TF-APCSR gmtime() says : Tue Apr 26 19:21:03 2016 localtime() says : Tue Apr 26 19:21:03 2016 *TF-APCSN Error: Shared C library is out of date (Error number &800E91) *Configure BST *TF-APCSR gmtime() says : Tue Apr 26 19:21:19 2016 localtime() says : Tue Apr 26 20:21:19 2016 *Configure GMT *RMLoad CLibJ *Help SharedCLibrary ==> Help on keyword SharedCLibrary Module is: C Library 5.88 (29 Feb 2016) *TF-APCSR gmtime() says : Tue Apr 26 19:21:47 2016 localtime() says : Tue Apr 26 19:21:47 2016 *TF-APCSN gmtime() says : Tue Apr 26 19:21:51 2016 localtime() says : Tue Apr 26 19:21:51 2016 *TF-APCS32 gmtime() says : Tue Apr 26 19:21:56 2016 localtime() says : Tue Apr 26 19:21:56 2016 *Configure BST *TF-APCSR gmtime() says : Tue Apr 26 19:22:16 2016 localtime() says : Tue Apr 26 20:22:16 2016 *TF-APCSN gmtime() says : Tue Apr 26 19:22:21 2016 localtime() says : Tue Apr 26 20:22:21 2016 *TF-APCS32 gmtime() says : Tue Apr 26 19:22:27 2016 localtime() says : Tue Apr 26 20:22:27 2016 * Result: No change (success) RISC OS 4.02Test results by ROOL, thanks. *fx 0 RISC OS 4.02 (10 Aug 1999) *config.dst *tf-apcsr gmtime() says : Sat May 7 07:15:47 2016 localtime() says : Sat May 7 08:15:47 2016 *tf-apcsr2 gmtime() says : Sat May 7 07:16:03 2016 localtime() says : Sat May 7 08:16:03 2016 *tf-apcsn Shared C library is out of date *tf-apcs32 Shared C library is out of date *config.nodst *tf-apcsr gmtime() says : Sat May 7 07:16:50 2016 localtime() says : Sat May 7 07:16:50 2016 *tf-apcsr2 gmtime() says : Sat May 7 07:16:53 2016 localtime() says : Sat May 7 07:16:53 2016 *rmload clib2632 *config.dst *tf-apcsr gmtime() says : Sat May 7 07:17:34 2016 localtime() says : Sat May 7 08:17:34 2016 *tf-apcsr2 gmtime() says : Sat May 7 07:17:38 2016 localtime() says : Sat May 7 08:17:38 2016 *tf-apcsn gmtime() says : Sat May 7 07:17:53 2016 localtime() says : Sat May 7 08:17:53 2016 *tf-apcs32 gmtime() says : Sat May 7 07:18:05 2016 localtime() says : Sat May 7 08:18:05 2016 *config.nodst *tf-apcsr gmtime() says : Sat May 7 07:18:21 2016 localtime() says : Sat May 7 07:18:21 2016 *tf-apcsr2 gmtime() says : Sat May 7 07:18:25 2016 localtime() says : Sat May 7 07:18:25 2016 *tf-apcs3mn gmtime() says : Sat May 7 07:18:36 2016 localtime() says : Sat May 7 07:18:36 2016 *tf-apcs32 gmtime() says : Sat May 7 07:18:40 2016 localtime() says : Sat May 7 07:18:40 2016 Result: No change (success) RISC OS 4.39Test results by ROOL, thanks. *fx0 RISC OS 4.39 (28 Apr 2004) [Kernel 6.80] (Error number &F7) *config.dst *tf-apcsr gmtime() says : Sat May 7 07:21:21 2016 localtime() says : Sat May 7 08:21:21 2016 *tf-apcsr2 gmtime() says : Sat May 7 07:21:23 2016 localtime() says : Sat May 7 08:21:23 2016 *tf-apcs32 Error: Shared C library is out of date (Error number &800E91) *tf-apcsn Error: Shared C library is out of date (Error number &800E91) *config.nodst *tf-apcsr gmtime() says : Sat May 7 07:21:44 2016 localtime() says : Sat May 7 07:21:44 2016 *tf-apcsr2 gmtime() says : Sat May 7 07:21:53 2016 localtime() says : Sat May 7 07:21:53 2016 *rmload clib2632 *config.dst *tf-apcsr gmtime() says : Sat May 7 07:22:23 2016 localtime() says : Sat May 7 08:22:23 2016 *tf-apcsr2 gmtime() says : Sat May 7 07:22:26 2016 localtime() says : Sat May 7 08:22:26 2016 *tf-apcsn gmtime() says : Sat May 7 07:22:28 2016 localtime() says : Sat May 7 08:22:28 2016 *tf-apcs32 gmtime() says : Sat May 7 07:22:41 2016 localtime() says : Sat May 7 08:22:41 2016 *config.nodst *tf-apcsr gmtime() says : Sat May 7 07:22:56 2016 localtime() says : Sat May 7 07:22:56 2016 *tf-apcsr2 gmtime() says : Sat May 7 07:22:58 2016 localtime() says : Sat May 7 07:22:58 2016 *tf-apcsn gmtime() says : Sat May 7 07:23:01 2016 localtime() says : Sat May 7 07:23:01 2016 *tf-apcs32 gmtime() says : Sat May 7 07:23:03 2016 localtime() says : Sat May 7 07:23:03 2016 Result: No change (success) RISC OS 5.xxCurrently unable to provide a test log as my 32 bit version of CLib (built for a Pi) crashes RPCEmu; so maybe has some later ARM code in it, or something? I can say that the test programs (excepting APCS-R version, obviously) work more or less as above on the Pi using the 5.23 ZPP build and original CLib, and also my custom version of RISC OS with the fix applied. That is to say, that the test programs work as expected in both instances. The only difference is that I am switching entire OS build rather than just softloading a new OS. I use my custom build specifically because the localtime function does not work for me. Result: Works as expected – but no log of such (I can make one in a couple of days if it is required) But, wait, why?Here is a short test to demonstrate the failings of the current implementation of localtime. I am using a modified version of the UK territory that also provides CET (GMT+1) and CEST (GMT+2) timezones. *Dir CLibTest *RMLoad UK-EUR *Configure GMT *TF-APCS32 gmtime() says : Tue Apr 26 19:36:32 2016 localtime() says : Tue Apr 26 19:36:32 2016 *Configure BST *TF-APCS32 gmtime() says : Tue Apr 26 20:36:43 2016 localtime() says : Tue Apr 26 21:36:43 2016 *Configure CET *TF-APCS32 gmtime() says : Tue Apr 26 20:36:59 2016 localtime() says : Tue Apr 26 20:36:59 2016 *Configure CEST *TF-APCS32 gmtime() says : Tue Apr 26 20:37:07 2016 localtime() says : Tue Apr 26 21:37:07 2016 * The first two are correct. The second two are incorrect because the current implementation looks for the offsets of the first timezone in the list, rather than the current actual timezone. This means CLib will always be working with GMT/BST. Plus, wrong is wrong and this was wrong. ROOL have my fix, and here’s the testing that was asked for. Can I go home now? ;-) |
||||||||||||||
Jeffrey Lee (213) 6048 posts |
Yes. Even if you’re building a softload/standalone version of a module it will still be using compiler flags and some other settings that are relevant for the product that was selected in Builder. The “Disc” or “BuildHost” products are the ones you’d usually want to use when building softload versions of components for testing on arbitrary machines. Their env files use a “Machine” setting of “All”, which basically means that as long as there aren’t any intrinsic assumptions about machine/OS within the code itself, the result will be a binary that runs on anything RISC OS 3.1+ from ARMv2 to ARMv8. The reason PlingSystem comes into things (apart from cutting down on the base disc image size) is that any C code built for the “All” machine type will be APCS-32. So you’ll have a 26bit build of CLib, but it will be using APCS-32 internally, and not contain any APCS-R support. PlingSystem avoids this by specifying APCS-R in the Env file (setting the default for all C code), and also by specifying the “-APCS 3/26bit” option for CLib itself (although I’m not sure offhand of the significance of that – making sure that it builds a CLib that supports both APCS-R and APCS-32, perhaps?) |