summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpointsman <rolf@pointsman.de>2023-05-22 12:17:44 (GMT)
committerpointsman <rolf@pointsman.de>2023-05-22 12:17:44 (GMT)
commit73ff912a1fd8edfb65a5b594ebecfc531eef79fc (patch)
treeae99bd2c46d8ee9b9c71409a0d3f7b8b21976198
parenta5297cf7c36358be626614b3363cc68a4d05c4ac (diff)
downloadtcl-73ff912a1fd8edfb65a5b594ebecfc531eef79fc.zip
tcl-73ff912a1fd8edfb65a5b594ebecfc531eef79fc.tar.gz
tcl-73ff912a1fd8edfb65a5b594ebecfc531eef79fc.tar.bz2
Proposed fix for [af3ebc5fafe0].
-rw-r--r--library/clock.tcl9
-rw-r--r--tests/clock.test18
2 files changed, 25 insertions, 2 deletions
diff --git a/library/clock.tcl b/library/clock.tcl
index abe6c81..5dc724a 100644
--- a/library/clock.tcl
+++ b/library/clock.tcl
@@ -1173,7 +1173,7 @@ proc ::tcl::clock::ParseClockFormatFormat2 {format locale procName} {
#
# Inputs a count of seconds since the Posix Epoch as a time of day.
#
-# The 'clock format' command scans times of day on input. Refer to the user
+# The 'clock scan' command scans times of day on input. Refer to the user
# documentation to see what it does.
#
#----------------------------------------------------------------------
@@ -1207,21 +1207,24 @@ proc ::tcl::clock::scan { args } {
# Pick up command line options.
foreach { flag value } [lreplace $args 0 0] {
- set saw($flag) {}
switch -exact -- $flag {
-b - -ba - -bas - -base {
set base $value
}
-f - -fo - -for - -form - -forma - -format {
+ set saw(-format) {}
set format $value
}
-g - -gm - -gmt {
+ set saw(-gmt) {}
set gmt $value
}
-l - -lo - -loc - -loca - -local - -locale {
+ set saw(-locale) {}
set locale [string tolower $value]
}
-t - -ti - -tim - -time - -timez - -timezo - -timezon - -timezone {
+ set saw(-timezone) {}
set timezone $value
}
default {
@@ -4261,6 +4264,7 @@ proc ::tcl::clock::add { clockval args } {
} else {
switch -exact -- $a {
-g - -gm - -gmt {
+ set saw(-gmt) {}
set gmt $b
}
-l - -lo - -loc - -loca - -local - -locale {
@@ -4268,6 +4272,7 @@ proc ::tcl::clock::add { clockval args } {
}
-t - -ti - -tim - -time - -timez - -timezo - -timezon -
-timezone {
+ set saw(-timezone) {}
set timezone $b
}
default {
diff --git a/tests/clock.test b/tests/clock.test
index c30fea3..5ac70a6 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -36772,6 +36772,15 @@ test clock-57.1 {clock scan - abbreviated options} {
clock scan 1970-01-01 -f %Y-%m-%d -g true
} 0
+test clock-57.2 {clock scan - not -gmt and -timezone in the same call} {
+ catch {clock scan 1970-01-01 -format %Y-%m-%d -gmt true -timezone :Europe/Berlin}
+} 1
+
+# Bug af3ebc5fafe009
+test clock-57.3 {clock scan - not -g and -timezone in the same call} {
+ catch {clock scan 1970-01-01 -format %Y-%m-%d -gmt true -timezone :Europe/Berlin}
+} 1
+
test clock-58.1 {clock l10n - Japanese localisation} {*}{
-setup {
proc backslashify { string } {
@@ -36984,6 +36993,15 @@ test clock-65.1 {clock add, bad option [Bug 2481670]} {*}{
-result {bad option "-foo"*}
}
+test clock-65.2 {clock add with both -timezone and -gmt} {*}{
+ -body {
+ clock add 0 1 year -timezone :CET -gmt true
+ }
+ -match glob
+ -returnCodes error
+ -result {cannot use -gmt and -timezone in same call}
+}
+
test clock-66.1 {clock scan, no date, never-before-seen timezone} {*}{
-setup {
::tcl::clock::ClearCaches