Changes On Branch bug-aee9f2b916
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch bug-aee9f2b916 Excluding Merge-Ins

This is equivalent to a diff from 92493234f7 to bf0e4fe924

2024-11-20
19:33
Fix [aee9f2b916]: clock scan -validate, ISO-8601, 24:00. Remove HAVE_MKTIME: It isn't used anywhere... check-in: 9e101107d1 user: jan.nijtmans tags: trunk, main
12:28
Fix handling of "24:00 am" -validate 0: Should be 24 hours after "00:00 am". Closed-Leaf check-in: bf0e4fe924 user: jan.nijtmans tags: bug-aee9f2b916
12:15
[aee9f2b916]: Allow "24:00", but only as indication for the end of the day. check-in: f77d6fcac2 user: jan.nijtmans tags: bug-aee9f2b916
2024-11-18
16:03
Ticket [5a1aaa20] proposed solution by Julian Noble (Thanks !) check-in: 7274285f90 user: oehhar tags: 5a1aaa20-lsearch-stride
10:48
Revert [b11c0b7e61], for testing purposes only. check-in: bc7fbd8e2e user: jan.nijtmans tags: bug-a8e4f76ce4
2024-11-16
19:35
Merge 9.0 check-in: 27d851bd8f user: jan.nijtmans tags: bug-f2b5f89c0d
2024-11-15
17:33
merge 8.7 check-in: 92493234f7 user: sebres tags: trunk, main
17:31
small amend check-in: 6dd50fd094 user: sebres tags: core-8-branch
15:21
try.n: Add an illustrative example to use "return" within a try block check-in: 0c0b2604f4 user: oehhar tags: trunk, main

Changes to generic/tclClock.c.
3737
3738
3739
3740
3741
3742
3743
3744
3745


3746
3747
3748
3749
3750
3751
3752
3737
3738
3739
3740
3741
3742
3743


3744
3745
3746
3747
3748
3749
3750
3751
3752







-
-
+
+







	    Tcl_SetObjResult(opts->interp, Tcl_NewStringObj(
		    "requested date too large to represent", TCL_AUTO_LENGTH));
	    Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", (char *)NULL);
	    return TCL_ERROR;
	}
    }

    /* If seconds overflows the day (no validate case), increase days */
    if (yySecondOfDay >= SECONDS_PER_DAY) {
    /* If seconds overflows the day (no validate and "24:00" case), increase days */
    if (yySecondOfDay >= SECONDS_PER_DAY + ((info->flags & CLF_TIME) && (yyHour == 24))) {
	yydate.julianDay += (yySecondOfDay / SECONDS_PER_DAY);
	yySecondOfDay %= SECONDS_PER_DAY;
    }

    /* Local seconds to UTC (stored in yydate.seconds) */

    if (info->flags & CLF_ASSEMBLE_SECONDS) {
3882
3883
3884
3885
3886
3887
3888
3889

3890
3891
3892
3893
3894
3895

3896
3897
3898
3899
3900
3901

3902
3903
3904
3905
3906
3907
3908
3882
3883
3884
3885
3886
3887
3888

3889
3890
3891
3892
3893
3894

3895
3896
3897
3898
3899
3900

3901
3902
3903
3904
3905
3906
3907
3908







-
+





-
+





-
+







	    errCode = "day";
	    goto error;
	}
    }

    if (info->flags & CLF_TIME) {
	/* hour */
	if (yyHour < 0 || yyHour > ((yyMeridian == MER24) ? 23 : 12)) {
	if (yyHour < 0 || yyHour > ((yyMeridian == MER24) ? 24 : 12)) {
	    errMsg = "invalid time (hour)";
	    errCode = "hour";
	    goto error;
	}
	/* minutes */
	if (yyMinutes < 0 || yyMinutes > 59) {
	if (yyMinutes < 0 || yyMinutes > 59 || (yyMinutes && (yyHour == 24))) {
	    errMsg = "invalid time (minutes)";
	    errCode = "minutes";
	    goto error;
	}
	/* oldscan could return secondOfDay (parsedTime) -1 by invalid time (ex.: 25:00:00) */
	if (yySeconds < 0 || yySeconds > 59 || yySecondOfDay <= -1) {
	if (yySeconds < 0 || yySeconds > 59 || yySecondOfDay <= -1 || (yySeconds && (yyHour == 24))) {
	    errMsg = "invalid time";
	    errCode = "seconds";
	    goto error;
	}
    }

    if (!(stage & CLF_VALIDATE_S2) || !(opts->flags & CLF_VALIDATE_S2)) {
Changes to generic/tclDate.c.
2344
2345
2346
2347
2348
2349
2350
2351

2352
2353

2354
2355
2356
2357
2358
2359
2360
2344
2345
2346
2347
2348
2349
2350

2351
2352

2353
2354
2355
2356
2357
2358
2359
2360







-
+

-
+







    int Seconds,
    MERIDIAN Meridian)
{
    switch (Meridian) {
    case MER24:
	return (Hours * 60 + Minutes) * 60 + Seconds;
    case MERam:
	return ((Hours % 12) * 60 + Minutes) * 60 + Seconds;
	return (((Hours / 24) * 24 + (Hours % 12)) * 60 + Minutes) * 60 + Seconds;
    case MERpm:
	return (((Hours % 12) + 12) * 60 + Minutes) * 60 + Seconds;
	return (((Hours / 24) * 24 + (Hours % 12) + 12) * 60 + Minutes) * 60 + Seconds;
    }
    return -1;			/* Should never be reached */
}

static int
LookupWord(
    YYSTYPE* yylvalPtr,
Changes to generic/tclGetDate.y.
714
715
716
717
718
719
720
721

722
723

724
725
726
727
728
729
730
714
715
716
717
718
719
720

721
722

723
724
725
726
727
728
729
730







-
+

-
+







    int Seconds,
    MERIDIAN Meridian)
{
    switch (Meridian) {
    case MER24:
	return (Hours * 60 + Minutes) * 60 + Seconds;
    case MERam:
	return ((Hours % 12) * 60 + Minutes) * 60 + Seconds;
	return (((Hours / 24) * 24 + (Hours % 12)) * 60 + Minutes) * 60 + Seconds;
    case MERpm:
	return (((Hours % 12) + 12) * 60 + Minutes) * 60 + Seconds;
	return (((Hours / 24) * 24 + (Hours % 12) + 12) * 60 + Minutes) * 60 + Seconds;
    }
    return -1;			/* Should never be reached */
}

static int
LookupWord(
    YYSTYPE* yylvalPtr,
Changes to tests/clock.test.
37177
37178
37179
37180
37181
37182
37183
37184

37185
37186

37187
37188

37189
37190

37191
37192
37193
37194
37195
37196
37197
37177
37178
37179
37180
37181
37182
37183

37184
37185

37186
37187

37188
37189

37190
37191
37192
37193
37194
37195
37196
37197







-
+

-
+

-
+

-
+







  test clock-46.7b {freescan: regression test - switch day by large not-valid time, see bug [3ee8f1c2a785f4d8]} {valid_off} {
    list [clock scan 23:59:59 -base 0 -gmt 1] \
	 [clock scan 24:00:00 -base 0 -gmt 1] \
	 [clock scan 48:00:00 -base 0 -gmt 1]
  } {86399 86400 172800}
} else {
  test clock-46.8a {regression test - invalid time (hour)} {
    list [catch {clock scan 24:00:00 -base 0 -gmt 1 -format %H:%M:%S} msg] $msg \
    list [catch {clock scan 24:00:01 -base 0 -gmt 1 -format %H:%M:%S} msg] $msg \
	 [catch {clock scan 48:00:00 -base 0 -gmt 1 -format %H:%M:%S} msg] $msg
  } {1 {unable to convert input string: invalid time (hour)} 1 {unable to convert input string: invalid time (hour)}}
  } {1 {unable to convert input string: invalid time} 1 {unable to convert input string: invalid time (hour)}}
  test clock-46.8b {freescan: regression test - invalid time (hour)} {
    list [catch {clock scan 24:00:00 -base 0 -gmt 1} msg] $msg \
    list [catch {clock scan 24:00:01 -base 0 -gmt 1} msg] $msg \
	 [catch {clock scan 48:00:00 -base 0 -gmt 1} msg] $msg
  } {1 {unable to convert input string: invalid time (hour)} 1 {unable to convert input string: invalid time (hour)}}
  } {1 {unable to convert input string: invalid time} 1 {unable to convert input string: invalid time (hour)}}
}

proc _invalid_test {testtz scnargs args} {
    global valid_mode
    # ensure validation works TZ independently, since the conversion
    # of local time to UTC may adjust date/time tokens, depending on TZ:
    set res {}
38465
38466
38467
38468
38469
38470
38471
38472
38473


38474
38475
38476
38477
38478
38479
38480
38465
38466
38467
38468
38469
38470
38471


38472
38473
38474
38475
38476
38477
38478
38479
38480







-
-
+
+







    # regardless solution for [f2b5f89c0d], this conversions must fail on -valid 1 (constraints !valid_off),
    # because of wrong day and month for the leap second:
    set res {}
    foreach {d i} {
	"2012-06-29 23:59:60" "invalid time"
	"2012-05-30 23:59:60" "invalid time"
	"2012-05-30 23:60:60" "invalid time"
	"2012-05-30 24:00:60" "invalid time"
	"2012-05-30 24:60:00" "invalid time"
	"2012-05-30 24:00:01" "invalid time"
	"2012-05-30 24:10:00" "invalid time"
    } {
	# check with free scan:
	if {![catch { clock scan $d -gmt 1 } t] || ![string match *$i* $t]} {
	    lappend res "free-scan \"$d\" == \"$t\", expected \"$i\""
	}
	# check with formatted scan:
	if {![catch { clock scan $d -gmt 1 -format "%Y-%m-%d %H:%M:%S" } t] || ![string match *$i* $t]} {