Commit 79a14eba authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Fix to localisation of OS_Word 15,15 when using nonzero timezones

The three subreasons were being dealt with as follows

8  - time only => convert time; read clock & convert that; mix; to UTC; set
15 - date only => convert date; to UTC; set
24 - both      => convert both; to UTC; set

So subreason 15 ended up setting the clock with the UTC date not taking into account any rollover/under due to the timezone. Now, the behaviour is

15 - date only => convert date; read clock & convert that; mix; to UTC; set

An example program to illustrate this is

 DIM block 128
 REM Example boundary case for -ve timezone
 REM *config.timezone -5
 REM TIME$="Sun,01 Jan 2013.19:01:00"

 REM Example boundary case for +ve timezone
 *config.timezone 5
 TIME$="Sun,01 Jan 2013.04:59:00"

 PRINT"Local => ";TIME$
 FOR i = 1 TO 31
  block?0=15
  $(block+1)="Sun,"+RIGHT$("0"+STR$i,2)+" Jan 2013"+CHR$0
  SYS"OS_Word",15,block
  OSCLI"echo <sys$time> <sys$date> <sys$year>"
 NEXT

Fault originates in Kernel-4_63-1_1_2_2.
Fixes ticket #230.

Version 5.35, 4.79.2.185. Tagged as 'Kernel-5_35-4_79_2_185'
parent 3758c6a1
......@@ -13,11 +13,11 @@
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35"
Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.184"
Module_MinorVersion SETS "4.79.2.185"
Module_Date SETS "24 Mar 2013"
Module_ApplicationDate SETS "24-Mar-13"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.184)"
Module_HelpVersion SETS "5.35 (24 Mar 2013) 4.79.2.184"
Module_FullVersion SETS "5.35 (4.79.2.185)"
Module_HelpVersion SETS "5.35 (24 Mar 2013) 4.79.2.185"
END
......@@ -5,12 +5,12 @@
*
*/
#define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.184
#define Module_MinorVersion_CMHG 4.79.2.185
#define Module_Date_CMHG 24 Mar 2013
#define Module_MajorVersion "5.35"
#define Module_Version 535
#define Module_MinorVersion "4.79.2.184"
#define Module_MinorVersion "4.79.2.185"
#define Module_Date "24 Mar 2013"
#define Module_ApplicationDate "24-Mar-13"
......@@ -18,6 +18,6 @@
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.184)"
#define Module_HelpVersion "5.35 (24 Mar 2013) 4.79.2.184"
#define Module_FullVersion "5.35 (4.79.2.185)"
#define Module_HelpVersion "5.35 (24 Mar 2013) 4.79.2.185"
#define Module_LibraryVersionInfo "5:35"
......@@ -544,21 +544,10 @@ OsWord0F ROUT
MOVEQ R9, #3
TEQ R9, #0
Pull "R5-R10, PC", EQ ; unknown call, pass it on
; first set up data in registers as follows :-
; R0 = hours
; R1 = minutes
; R2 = days
; R3 = months
; (R4 -> block)
; R5 = year(lo)
; R6 = year(hi)
; R7 = seconds
; R8 = centiseconds
Pull "R5-R10, PC", EQ ; unknown call, pass it on
TST R9, #2
BEQ %FT01
BEQ %FT01 ; no date parsing
; KJB 980908 - can't assume length of date, as %w3, %dy and %m3 may be any length. Unfortunately,
; the string may not be terminated. Best we can do is plop a terminator at the maximum length position,
......@@ -612,27 +601,30 @@ OsWord0F ROUT
ADDVS sp, sp, r10 ; and junk variable length string on stack
BVS Bad0F
CMP r9, #2 ; if just writing the date, write it !
BEQ %FT10
BGT %FT05 ; if writing everything just get UTC time
CMP r9, #2 ; if writing everything just go to UTC conversion step
BHI %FT05
; We only have the time from the string, we now need the date
; because changing the time may change it.
; We have the time but no date, or have the date but no time. Get the missing fields
; because changing the one can roll the other across a timezone.
ADDLO r7, sp, #0*4
ADDEQ r7, sp, #4*4
LDMIA r7, {r3-r6} ; preserve the values we have converted
ADR r0, RealTime
LDMIA r0, {r0,r1} ; LDM is atomic wrt interrupts
Push "r0,r1" ; put value on stack
MOV r0,#-1 ; use configured territory.
ADD r2, sp, #8
LDMIA r2, {r3-r6} ; preserve time values from entry string
MOV r1, sp
ADD r2, sp, #8
SWI XTerritory_ConvertTimeToOrdinals ; get ordinals for current time
ADDVS sp, sp, #44 ; 36 From above + 8 for 5 byte time
ADDVS sp, sp, #36+8 ; 36 from above + 8 for stacked 5 byte time
ADDVS sp, sp, r10 ; and junk string as well
BVS Bad0F
ADD sp, sp, #8 ; dump 5 byte time on TOS
STMIA r2, {r3-r6} ; restore the time we read from the string.
STMIA r7, {r3-r6} ; restore the values we have converted
05
; Now [SP] -> ordinals in local time, but we want time in UTC
......@@ -643,7 +635,7 @@ OsWord0F ROUT
SUB sp, sp, #8 ; two more words to contain 5 byte time
MOV r1, sp
SWI XTerritory_ConvertOrdinalsToTime
ADDVS sp, sp, #44 ; 36 From above + 8 for 5 byte time.
ADDVS sp, sp, #36+8 ; 36 from above + 8 for 5 byte time
ADDVS sp, sp, r10 ; and junk string as well
BVS Bad0F
......@@ -652,7 +644,7 @@ OsWord0F ROUT
MOV r1, sp ; our 5 byte time
ADD r2, sp, #8 ; place to put ordinals
SWI XTerritory_ConvertTimeToUTCOrdinals
ADDVS sp, sp, #44 ; 36 bytes ordinals + 8 for 5 byte time.
ADDVS sp, sp, #36+8 ; 36 bytes ordinals + 8 for 5 byte time
ADDVS sp, sp, r10 ; and junk string as well
BVS Bad0F
......@@ -664,7 +656,7 @@ OsWord0F ROUT
LDR r8, [sp], #4 ; centiseconds
LDR r7, [sp], #4 ; seconds
LDR r1, [sp], #4 ; minutes
Pull "r0,r2,r3,r5" ; hours, day of month, month, year
Pull "r0,r2,r3,r5" ; hours, day of month, month, year
ADD sp, sp, #8 ; junk day of week, day of year
ADD sp, sp, r10 ; and string on stack
MOV r4, #100
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment