Ticket #629 (Open)Sun Feb 25 19:14:10 UTC 2024
Pinebook RTC uses different epoch year compared to Linux
Reported by: | Cameron Cawley (3514) | Severity: | Normal |
Part: | RISC OS: General | Release: | |
Milestone: | Status | Open |
Details by Cameron Cawley (3514):
Despite the Pinebook HAL adding 10 to the year read from the RTC registers to “align to linux base”, the year is reported 40 years ahead if Linux was the most recent platform to set the time.
Changelog:
Modified by Chris Hall (132) Thu, February 29 2024 - 09:11:14 GMT
This can be worked around, as described in an Article in WROCC Dec 2023 magazine. A programme ‘Tardis6’ placed in PreDesk will force a 205x or 206x date to 202×. Guaranteed until 2029.
10 : REM >Tardis6
20 : DIM mem% 1024
30 : SYS “OS_Byte”,161,128 TO ,,yL%
40 : SYS “OS_Byte”,161,129 TO ,,yH%
50 : REM PRINT “CMOS year = ”;100*yH%yL%
60 : IF 100*yH%yL%>2050 THEN
70 : REM Force CMOS year to 202x from e.g. 205x or 206x
80 : CASE yL% DIV 10 OF
90 : WHEN 5
100 : yL%-=30
110 : SYS “OS_Byte”,162,128,yL%
120 : WHEN 6
130 : yL%-=40
140 : SYS “OS_Byte”,162,128,yL%
150 : ENDCASE
160 : ENDIF
170 : :
180 : REM Now read RISC OS 5-byte time
190 : !mem%=3
200 : SYS “OS_Word”,14,mem%
210 : SYS “Territory_ConvertTimeToOrdinals”,-1,mem%,mem%8
220 : REM PRINT “Date OSWORD read day=”;mem%!24;“ month=”;mem%!28;“ year=”;mem%!32
230 : REM adjust date – I’ll test for 205x and 206x and set 202x
240 : zz%=mem%!32
250 : CASE zz% DIV 10 OF
260 : WHEN 205:REM 205x
270 : zz%-=30
271 : mem%!32=zz%
290 : SYS “Territory_ConvertOrdinalsToTime”,-1,mem%1,mem%8
300 : ?mem%=5
310 : SYS “OS_Word”,15,mem%
320 : WHEN 206:REM 206x
330 : zz%-=40
340 : mem%!32=zz%
350 : SYS “Territory_ConvertOrdinalsToTime”,-1,mem%1,mem%+8
360 : ?mem%=5
370 : SYS “OS_Word”,15,mem%
380 : ENDCASE
Modified by Chris Hall (132) Thu, February 29 2024 - 09:18:05 GMT
- Attachment added: Tardis6.jpg
Programme listing unmungled by Textile is attached: