[tz] [PROPOSED 3/3] tzselect: support POSIX.1-2024 offset range
Paul Eggert
eggert at cs.ucla.edu
Wed Jun 12 20:47:44 UTC 2024
* NEWS: Mention this.
* tzselect.ksh (check_POSIX_TZ_string): Support the extended
offset range of POSIX.1-2024, so that users can enter a proleptic
TZ setting like "IST-2IDT,M3.4.4/26,M10.5.0".
---
NEWS | 7 ++++---
tzselect.ksh | 13 +++++++------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/NEWS b/NEWS
index 8f362cb9..6a2c7398 100644
--- a/NEWS
+++ b/NEWS
@@ -64,9 +64,10 @@ Unreleased, experimental changes
The SUPPORT_C89 option now defaults to 1 instead of 0, fixing a
POSIX-conformance bug introduced in 2023a.
- tzselect now assumes POSIX.2-1992 or later, as practical porting
- targets now all support this. Also, tzselect uses some features
- from POSIX.1-2024 if available.
+ tzselect now supports POSIX.1-2024 proleptic TZ strings. Also, it
+ assumes POSIX.2-1992 or later, as practical porting targets now
+ all support that, and it uses some features from POSIX.1-2024 if
+ available.
Changes to build procedure
diff --git a/tzselect.ksh b/tzselect.ksh
index 48159afd..ca3d82c6 100644
--- a/tzselect.ksh
+++ b/tzselect.ksh
@@ -425,7 +425,7 @@ while
eval '
doselect '"$quoted_continents"' \
"coord - I want to use geographical coordinates." \
- "TZ - I want to specify the timezone using a POSIX.1-2017 TZ string." \
+ "TZ - I want to specify the timezone using a proleptic TZ string." \
"time - I know local time already." \
"now - Like \"time\", but configure only for timestamps from now on."
continent=$select_result
@@ -449,16 +449,17 @@ while
case $continent in
TZ)
- # Ask the user for a POSIX.1-2017 TZ string. Check that it conforms.
+ # Ask the user for a proleptic TZ string. Check that it conforms.
check_POSIX_TZ_string='
BEGIN {
tz = substr(ARGV[1], 2)
ARGV[1] = ""
tzname = ("(<[[:alnum:]+-][[:alnum:]+-][[:alnum:]+-]+>" \
"|[[:alpha:]][[:alpha:]][[:alpha:]]+)")
- time = ("(2[0-4]|[0-1]?[0-9])" \
- "(:[0-5][0-9](:[0-5][0-9])?)?")
- offset = "[-+]?" time
+ sign = "[-+]?"
+ hhmm = "(:[0-5][0-9](:[0-5][0-9])?)?"
+ offset = sign "(2[0-4]|[0-1]?[0-9])" hhmm
+ time = sign "(16[0-7]|(1[0-5]|[0-9]?)[0-9])" hhmm
mdate = "M([1-9]|1[0-2])\\.[1-5]\\.[0-6]"
jdate = ("((J[1-9]|[0-9]|J?[1-9][0-9]" \
"|J?[1-2][0-9][0-9])|J?3[0-5][0-9]|J?36[0-5])")
@@ -479,7 +480,7 @@ while
read tz
$AWK "$check_POSIX_TZ_string" ="$tz"
do
- say >&2 "'$tz' is not a conforming POSIX.1-2017 timezone string."
+ say >&2 "'$tz' is not a conforming POSIX proleptic TZ string."
done
TZ_for_date=$tz;;
*)
--
2.43.0
More information about the tz
mailing list