Commit 332c9e74 authored by ROOL's avatar ROOL 🤖

[391] localtime() ignores manual timezone configuration

Detail:
  When in the default C locale localtime() would return the wrong time for nonzero timezones.
Admin:
  Tested with softloaded C library for each ROM release supported.
  Submission from Rick Murray.

Version 5.90. Tagged as 'RISC_OSLib-5_90'
parent 377852c3
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.89"
Module_Version SETA 589
Module_MajorVersion SETS "5.90"
Module_Version SETA 590
Module_MinorVersion SETS ""
Module_Date SETS "08 May 2016"
Module_ApplicationDate SETS "08-May-16"
Module_Date SETS "14 May 2016"
Module_ApplicationDate SETS "14-May-16"
Module_ComponentName SETS "RISC_OSLib"
Module_ComponentPath SETS "castle/RiscOS/Sources/Lib/RISC_OSLib"
Module_FullVersion SETS "5.89"
Module_HelpVersion SETS "5.89 (08 May 2016)"
Module_FullVersion SETS "5.90"
Module_HelpVersion SETS "5.90 (14 May 2016)"
END
/* (5.89)
/* (5.90)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 5.89
#define Module_MajorVersion_CMHG 5.90
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 May 2016
#define Module_Date_CMHG 14 May 2016
#define Module_MajorVersion "5.89"
#define Module_Version 589
#define Module_MajorVersion "5.90"
#define Module_Version 590
#define Module_MinorVersion ""
#define Module_Date "08 May 2016"
#define Module_Date "14 May 2016"
#define Module_ApplicationDate "08-May-16"
#define Module_ApplicationDate "14-May-16"
#define Module_ComponentName "RISC_OSLib"
#define Module_ComponentPath "castle/RiscOS/Sources/Lib/RISC_OSLib"
#define Module_FullVersion "5.89"
#define Module_HelpVersion "5.89 (08 May 2016)"
#define Module_LibraryVersionInfo "5:89"
#define Module_FullVersion "5.90"
#define Module_HelpVersion "5.90 (14 May 2016)"
#define Module_LibraryVersionInfo "5:90"
......@@ -253,15 +253,19 @@ struct tm *localtime(const time_t *timer)
territory = __locales[N_LC_TIME];
if (!territory) {
r.r[0] = -1; /* If C locale use current configured territory */
/* C locale uses currently configured offset */
if (_kernel_swi(Territory_ReadCurrentTimeZone, &r, &r) == NULL) {
t += r.r[1] / 100; /* centiseconds -> seconds */
}
} else {
/* Specific locale */
r.r[0] = TERRITORY_EXTRACT(territory);
r.r[1] = TERRITORY_TZ_EXTRACT(territory);
r.r[4] = TERRITORY_TZ_API_EXT; /* If not supported, never mind */
}
if (_kernel_swi(Territory_ReadTimeZones, &r, &r) == NULL) {
v = (dst == 0x8000) ? r.r[3] : r.r[2];
t += v / 100; /* centiseconds -> seconds */
if (_kernel_swi(Territory_ReadTimeZones, &r, &r) == NULL) {
v = (dst == 0x8000) ? r.r[3] : r.r[2];
t += v / 100; /* centiseconds -> seconds */
}
}
/* Already corrected for locale, so just need to mangle it */
......
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