From f77d355196ec60d248464b6b78b6b4f227ee82ae Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Thu, 9 Jul 2020 07:57:32 +0000 Subject: Proposed fix for [5019748c73]: FreeScan resp. Oldscan does not recognize positive time zone offset like "31 Jan 14 23:59:59 +0100" --- generic/tclDate.c | 250 ++++++++++++++++++++++++--------------------------- generic/tclGetDate.y | 21 +---- tests/clock.test | 101 +++++++++++++-------- 3 files changed, 184 insertions(+), 188 deletions(-) diff --git a/generic/tclDate.c b/generic/tclDate.c index dcb85e9..5410046 100644 --- a/generic/tclDate.c +++ b/generic/tclDate.c @@ -560,16 +560,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 86 +#define YYLAST 81 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 26 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 16 /* YYNRULES -- Number of rules. */ -#define YYNRULES 57 +#define YYNRULES 56 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 89 +#define YYNSTATES 85 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ @@ -587,7 +587,7 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 25, 22, 21, 24, 23, 2, 2, + 2, 2, 2, 25, 21, 23, 24, 22, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 20, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -618,11 +618,11 @@ static const yytype_uint8 yytranslate[] = static const yytype_uint16 yyrline[] = { 0, 223, 223, 224, 227, 230, 233, 236, 239, 242, - 245, 249, 254, 257, 263, 269, 277, 283, 294, 299, - 304, 310, 314, 318, 322, 326, 332, 336, 341, 346, - 351, 356, 360, 365, 369, 374, 381, 385, 391, 401, - 410, 419, 429, 443, 448, 451, 454, 457, 460, 463, - 468, 471, 476, 480, 484, 490, 508, 511 + 245, 249, 254, 257, 263, 269, 277, 282, 287, 291, + 297, 301, 305, 309, 313, 319, 323, 328, 333, 338, + 343, 347, 352, 356, 361, 368, 372, 378, 388, 397, + 406, 416, 430, 435, 438, 441, 444, 447, 450, 455, + 458, 463, 467, 471, 477, 495, 498 }; #endif @@ -634,7 +634,7 @@ static const char *const yytname[] = "$end", "error", "$undefined", "tAGO", "tDAY", "tDAYZONE", "tID", "tMERIDIAN", "tMONTH", "tMONTH_UNIT", "tSTARDATE", "tSEC_UNIT", "tSNUMBER", "tUNUMBER", "tZONE", "tEPOCH", "tDST", "tISOBASE", - "tDAY_UNIT", "tNEXT", "':'", "'-'", "','", "'/'", "'.'", "'+'", + "tDAY_UNIT", "tNEXT", "':'", "','", "'/'", "'-'", "'.'", "'+'", "$accept", "spec", "item", "time", "zone", "day", "date", "ordMonth", "iso", "trek", "relspec", "relunits", "sign", "unit", "number", "o_merid", YY_NULLPTR @@ -648,14 +648,14 @@ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 58, 45, 44, 47, 46, 43 + 58, 44, 47, 45, 46, 43 }; # endif -#define YYPACT_NINF -22 +#define YYPACT_NINF -18 #define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-22))) + (!!((Yystate) == (-18))) #define YYTABLE_NINF -1 @@ -666,15 +666,15 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int8 yypact[] = { - -22, 2, -22, -21, -22, -4, -22, 1, -22, 22, - 18, -22, 8, -22, 40, -22, -22, -22, -22, -22, - -22, -22, -22, -22, -22, -22, 32, 28, -22, -22, - -22, 24, 26, -22, -22, 42, 47, -5, 49, -22, - -22, 15, -22, -22, -22, 48, -22, -22, 43, 50, - 51, -22, 17, 44, 46, 45, 52, -22, -22, -22, - -22, -22, -22, -22, -22, 56, 57, -22, 58, 60, - 61, 62, -3, -22, -22, 63, -22, 59, 65, -22, - 67, 68, -22, 64, -22, 69, 66, 70, -22 + -18, 2, -18, -17, -18, -4, -18, 10, -18, 22, + 8, -18, 18, -18, 39, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, 25, 21, -18, -18, + -18, 16, 14, -18, -18, 28, 36, 41, -5, -18, + -18, 5, -18, -18, -18, 47, -18, -18, 42, 46, + 48, -18, -6, 40, 43, 44, 49, -18, -18, -18, + -18, -18, -18, -18, -18, 50, -18, 51, 55, 57, + 58, 65, -18, -18, 59, 54, -18, 62, 63, 60, + -18, 64, 61, 66, -18 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -682,29 +682,29 @@ static const yytype_int8 yypact[] = means the default is an error. */ static const yytype_uint8 yydefact[] = { - 2, 0, 1, 21, 20, 0, 54, 0, 52, 55, - 19, 34, 28, 53, 0, 50, 51, 3, 4, 5, - 8, 6, 7, 10, 11, 9, 44, 0, 49, 12, - 22, 31, 0, 23, 13, 33, 0, 0, 0, 46, - 18, 0, 41, 25, 36, 0, 47, 43, 0, 0, - 0, 35, 56, 0, 0, 26, 0, 39, 37, 48, - 24, 45, 32, 42, 57, 0, 0, 14, 0, 0, - 0, 0, 56, 15, 29, 30, 27, 0, 0, 16, - 0, 0, 17, 0, 40, 0, 0, 0, 38 + 2, 0, 1, 20, 18, 0, 53, 0, 51, 54, + 17, 33, 27, 52, 0, 49, 50, 3, 4, 5, + 8, 6, 7, 10, 11, 9, 43, 0, 48, 12, + 21, 30, 0, 22, 13, 32, 0, 0, 0, 45, + 16, 0, 40, 24, 35, 0, 46, 42, 19, 0, + 0, 34, 55, 25, 0, 0, 0, 38, 36, 47, + 23, 44, 31, 41, 56, 0, 14, 0, 0, 0, + 0, 55, 26, 28, 29, 0, 15, 0, 0, 0, + 39, 0, 0, 0, 37 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { - -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, - -22, -22, -22, -9, -22, 4 + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -9, -18, 7 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 1, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 67 + 25, 26, 27, 28, 29, 66 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -712,28 +712,28 @@ static const yytype_int8 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_uint8 yytable[] = { - 39, 30, 2, 53, 64, 46, 3, 4, 54, 31, - 5, 6, 7, 8, 32, 9, 10, 11, 78, 12, - 13, 14, 41, 15, 64, 42, 33, 16, 56, 34, - 35, 6, 57, 8, 40, 47, 59, 65, 66, 61, - 13, 48, 36, 37, 43, 38, 49, 60, 44, 6, - 50, 8, 6, 45, 8, 51, 58, 6, 13, 8, - 52, 13, 55, 62, 63, 68, 13, 69, 70, 72, - 73, 74, 71, 75, 76, 77, 79, 80, 82, 81, - 83, 84, 86, 88, 85, 0, 87 + 39, 64, 2, 54, 30, 46, 3, 4, 55, 31, + 5, 6, 7, 8, 65, 9, 10, 11, 56, 12, + 13, 14, 57, 32, 40, 15, 33, 16, 47, 34, + 35, 6, 41, 8, 48, 42, 59, 49, 50, 61, + 13, 51, 36, 43, 37, 38, 60, 44, 6, 52, + 8, 6, 45, 8, 53, 58, 6, 13, 8, 62, + 13, 63, 67, 71, 72, 13, 68, 69, 73, 70, + 74, 75, 64, 77, 78, 79, 80, 82, 76, 84, + 81, 83 }; -static const yytype_int8 yycheck[] = +static const yytype_uint8 yycheck[] = { - 9, 22, 0, 8, 7, 14, 4, 5, 13, 13, - 8, 9, 10, 11, 13, 13, 14, 15, 21, 17, - 18, 19, 14, 21, 7, 17, 4, 25, 13, 7, - 8, 9, 17, 11, 16, 3, 45, 20, 21, 48, - 18, 13, 20, 21, 4, 23, 22, 4, 8, 9, - 24, 11, 9, 13, 11, 13, 8, 9, 18, 11, - 13, 18, 13, 13, 13, 21, 18, 21, 23, 13, - 13, 13, 20, 13, 13, 13, 72, 14, 13, 20, - 13, 13, 13, 13, 20, -1, 20 + 9, 7, 0, 8, 21, 14, 4, 5, 13, 13, + 8, 9, 10, 11, 20, 13, 14, 15, 13, 17, + 18, 19, 17, 13, 16, 23, 4, 25, 3, 7, + 8, 9, 14, 11, 13, 17, 45, 21, 24, 48, + 18, 13, 20, 4, 22, 23, 4, 8, 9, 13, + 11, 9, 13, 11, 13, 8, 9, 18, 11, 13, + 18, 13, 22, 13, 13, 18, 23, 23, 13, 20, + 13, 13, 7, 14, 20, 13, 13, 13, 71, 13, + 20, 20 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -741,36 +741,36 @@ static const yytype_int8 yycheck[] = static const yytype_uint8 yystos[] = { 0, 27, 0, 4, 5, 8, 9, 10, 11, 13, - 14, 15, 17, 18, 19, 21, 25, 28, 29, 30, + 14, 15, 17, 18, 19, 23, 25, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 22, 13, 13, 4, 7, 8, 20, 21, 23, 39, - 16, 14, 17, 4, 8, 13, 39, 3, 13, 22, - 24, 13, 13, 8, 13, 13, 13, 17, 8, 39, - 4, 39, 13, 13, 7, 20, 21, 41, 21, 21, - 23, 20, 13, 13, 13, 13, 13, 13, 21, 41, - 14, 20, 13, 13, 13, 20, 13, 20, 13 + 21, 13, 13, 4, 7, 8, 20, 22, 23, 39, + 16, 14, 17, 4, 8, 13, 39, 3, 13, 21, + 24, 13, 13, 13, 8, 13, 13, 17, 8, 39, + 4, 39, 13, 13, 7, 20, 41, 22, 23, 23, + 20, 13, 13, 13, 13, 13, 41, 14, 20, 13, + 13, 20, 13, 20, 13 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 26, 27, 27, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 29, 29, 29, 29, 29, 30, 30, - 30, 31, 31, 31, 31, 31, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 33, 33, 34, 34, - 34, 34, 35, 36, 36, 37, 37, 37, 37, 37, - 38, 38, 39, 39, 39, 40, 41, 41 + 28, 28, 28, 29, 29, 29, 30, 30, 30, 30, + 31, 31, 31, 31, 31, 32, 32, 32, 32, 32, + 32, 32, 32, 32, 32, 33, 33, 34, 34, 34, + 34, 35, 36, 36, 37, 37, 37, 37, 37, 38, + 38, 39, 39, 39, 40, 41, 41 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 4, 5, 6, 7, 2, 1, - 1, 1, 2, 2, 3, 2, 3, 5, 1, 5, - 5, 2, 4, 2, 1, 3, 2, 3, 11, 3, - 7, 2, 4, 2, 1, 3, 2, 2, 3, 1, - 1, 1, 1, 1, 1, 1, 0, 1 + 1, 1, 1, 2, 4, 6, 2, 1, 1, 2, + 1, 2, 2, 3, 2, 3, 5, 1, 5, 5, + 2, 4, 2, 1, 3, 2, 3, 11, 3, 7, + 2, 4, 2, 1, 3, 2, 2, 3, 1, 1, + 1, 1, 1, 1, 1, 0, 1 }; @@ -1641,12 +1641,10 @@ yyreduce: case 15: { - yyHour = (yyvsp[-4].Number); - yyMinutes = (yyvsp[-2].Number); - yyMeridian = MER24; - yyDSTmode = DSToff; - yyTimezone = ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60); - ++yyHaveZone; + yyHour = (yyvsp[-5].Number); + yyMinutes = (yyvsp[-3].Number); + yySeconds = (yyvsp[-1].Number); + yyMeridian = (yyvsp[0].Meridian); } break; @@ -1654,10 +1652,9 @@ yyreduce: case 16: { - yyHour = (yyvsp[-5].Number); - yyMinutes = (yyvsp[-3].Number); - yySeconds = (yyvsp[-1].Number); - yyMeridian = (yyvsp[0].Meridian); + yyTimezone = (yyvsp[-1].Number); + if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100); + yyDSTmode = DSTon; } break; @@ -1665,13 +1662,9 @@ yyreduce: case 17: { - yyHour = (yyvsp[-6].Number); - yyMinutes = (yyvsp[-4].Number); - yySeconds = (yyvsp[-2].Number); - yyMeridian = MER24; + yyTimezone = (yyvsp[0].Number); + if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100); yyDSTmode = DSToff; - yyTimezone = ((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60); - ++yyHaveZone; } break; @@ -1679,8 +1672,7 @@ yyreduce: case 18: { - yyTimezone = (yyvsp[-1].Number); - if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100); + yyTimezone = (yyvsp[0].Number); yyDSTmode = DSTon; } @@ -1689,8 +1681,7 @@ yyreduce: case 19: { - yyTimezone = (yyvsp[0].Number); - if (yyTimezone > HOUR( 12)) yyTimezone -= HOUR(100); + yyTimezone = -(yyvsp[-1].Number)*((yyvsp[0].Number) % 100 + ((yyvsp[0].Number) / 100) * 60); yyDSTmode = DSToff; } @@ -1699,22 +1690,13 @@ yyreduce: case 20: { - yyTimezone = (yyvsp[0].Number); - yyDSTmode = DSTon; - } - - break; - - case 21: - - { yyDayOrdinal = 1; yyDayNumber = (yyvsp[0].Number); } break; - case 22: + case 21: { yyDayOrdinal = 1; @@ -1723,7 +1705,7 @@ yyreduce: break; - case 23: + case 22: { yyDayOrdinal = (yyvsp[-1].Number); @@ -1732,7 +1714,7 @@ yyreduce: break; - case 24: + case 23: { yyDayOrdinal = (yyvsp[-2].Number) * (yyvsp[-1].Number); @@ -1741,7 +1723,7 @@ yyreduce: break; - case 25: + case 24: { yyDayOrdinal = 2; @@ -1750,7 +1732,7 @@ yyreduce: break; - case 26: + case 25: { yyMonth = (yyvsp[-2].Number); @@ -1759,7 +1741,7 @@ yyreduce: break; - case 27: + case 26: { yyMonth = (yyvsp[-4].Number); @@ -1769,7 +1751,7 @@ yyreduce: break; - case 28: + case 27: { yyYear = (yyvsp[0].Number) / 10000; @@ -1779,7 +1761,7 @@ yyreduce: break; - case 29: + case 28: { yyDay = (yyvsp[-4].Number); @@ -1789,7 +1771,7 @@ yyreduce: break; - case 30: + case 29: { yyMonth = (yyvsp[-2].Number); @@ -1799,7 +1781,7 @@ yyreduce: break; - case 31: + case 30: { yyMonth = (yyvsp[-1].Number); @@ -1808,7 +1790,7 @@ yyreduce: break; - case 32: + case 31: { yyMonth = (yyvsp[-3].Number); @@ -1818,7 +1800,7 @@ yyreduce: break; - case 33: + case 32: { yyMonth = (yyvsp[0].Number); @@ -1827,7 +1809,7 @@ yyreduce: break; - case 34: + case 33: { yyMonth = 1; @@ -1837,7 +1819,7 @@ yyreduce: break; - case 35: + case 34: { yyMonth = (yyvsp[-1].Number); @@ -1847,7 +1829,7 @@ yyreduce: break; - case 36: + case 35: { yyMonthOrdinal = 1; @@ -1856,7 +1838,7 @@ yyreduce: break; - case 37: + case 36: { yyMonthOrdinal = (yyvsp[-1].Number); @@ -1865,7 +1847,7 @@ yyreduce: break; - case 38: + case 37: { if ((yyvsp[-5].Number) != HOUR( 7) + HOUR(100)) YYABORT; @@ -1879,7 +1861,7 @@ yyreduce: break; - case 39: + case 38: { if ((yyvsp[-1].Number) != HOUR( 7) + HOUR(100)) YYABORT; @@ -1893,7 +1875,7 @@ yyreduce: break; - case 40: + case 39: { if ((yyvsp[-5].Number) != HOUR( 7) + HOUR(100)) YYABORT; @@ -1907,7 +1889,7 @@ yyreduce: break; - case 41: + case 40: { yyYear = (yyvsp[-1].Number) / 10000; @@ -1920,7 +1902,7 @@ yyreduce: break; - case 42: + case 41: { /* @@ -1937,7 +1919,7 @@ yyreduce: break; - case 43: + case 42: { yyRelSeconds *= -1; @@ -1947,7 +1929,7 @@ yyreduce: break; - case 45: + case 44: { *yyRelPointer += (yyvsp[-2].Number) * (yyvsp[-1].Number) * (yyvsp[0].Number); @@ -1955,7 +1937,7 @@ yyreduce: break; - case 46: + case 45: { *yyRelPointer += (yyvsp[-1].Number) * (yyvsp[0].Number); @@ -1963,7 +1945,7 @@ yyreduce: break; - case 47: + case 46: { *yyRelPointer += (yyvsp[0].Number); @@ -1971,7 +1953,7 @@ yyreduce: break; - case 48: + case 47: { *yyRelPointer += (yyvsp[-1].Number) * (yyvsp[0].Number); @@ -1979,7 +1961,7 @@ yyreduce: break; - case 49: + case 48: { *yyRelPointer += (yyvsp[0].Number); @@ -1987,7 +1969,7 @@ yyreduce: break; - case 50: + case 49: { (yyval.Number) = -1; @@ -1995,7 +1977,7 @@ yyreduce: break; - case 51: + case 50: { (yyval.Number) = 1; @@ -2003,7 +1985,7 @@ yyreduce: break; - case 52: + case 51: { (yyval.Number) = (yyvsp[0].Number); @@ -2012,7 +1994,7 @@ yyreduce: break; - case 53: + case 52: { (yyval.Number) = (yyvsp[0].Number); @@ -2021,7 +2003,7 @@ yyreduce: break; - case 54: + case 53: { (yyval.Number) = (yyvsp[0].Number); @@ -2030,7 +2012,7 @@ yyreduce: break; - case 55: + case 54: { if (yyHaveTime && yyHaveDate && !yyHaveRel) { @@ -2051,7 +2033,7 @@ yyreduce: break; - case 56: + case 55: { (yyval.Meridian) = MER24; @@ -2059,7 +2041,7 @@ yyreduce: break; - case 57: + case 56: { (yyval.Meridian) = (yyvsp[0].Meridian); diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y index 578f179..86037d6 100644 --- a/generic/tclGetDate.y +++ b/generic/tclGetDate.y @@ -266,29 +266,12 @@ time : tUNUMBER tMERIDIAN { yySeconds = 0; yyMeridian = $4; } - | tUNUMBER ':' tUNUMBER '-' tUNUMBER { - yyHour = $1; - yyMinutes = $3; - yyMeridian = MER24; - yyDSTmode = DSToff; - yyTimezone = ($5 % 100 + ($5 / 100) * 60); - ++yyHaveZone; - } | tUNUMBER ':' tUNUMBER ':' tUNUMBER o_merid { yyHour = $1; yyMinutes = $3; yySeconds = $5; yyMeridian = $6; } - | tUNUMBER ':' tUNUMBER ':' tUNUMBER '-' tUNUMBER { - yyHour = $1; - yyMinutes = $3; - yySeconds = $5; - yyMeridian = MER24; - yyDSTmode = DSToff; - yyTimezone = ($7 % 100 + ($7 / 100) * 60); - ++yyHaveZone; - } ; zone : tZONE tDST { @@ -305,6 +288,10 @@ zone : tZONE tDST { yyTimezone = $1; yyDSTmode = DSTon; } + | sign tUNUMBER { + yyTimezone = -$1*($2 % 100 + ($2 / 100) * 60); + yyDSTmode = DSToff; + } ; day : tDAY { diff --git a/tests/clock.test b/tests/clock.test index f7da08f..a3498e8 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -254,7 +254,6 @@ proc ::testClock::registry { cmd path key } { return [dict get $reg $path $key] } - # Test some of the basics of [clock format] test clock-1.0 "clock format - wrong # args" { @@ -35635,7 +35634,6 @@ test clock-34.11 {clock scan tests} { set time [clock scan "1/1/37" -gmt true] clock format $time -format {%b %d,%Y %H:%M GMT} -gmt true } {Jan 01,2037 00:00 GMT} - test clock-34.12 {clock scan, relative times} { set time [clock scan "Oct 23, 1992 -1 day"] clock format $time -format {%b %d, %Y} @@ -35664,30 +35662,6 @@ test clock-34.18 {clock scan, ISO 8601 point in time format} { set time [clock scan "19921023T000000"] clock format $time -format {%b %d, %Y %H:%M:%S} } "Oct 23, 1992 00:00:00" -test clock-34.19 {clock scan, ISO 8601 point in time format} { - set time [clock scan "19921023T00:00:00"] - clock format $time -format {%b %d, %Y %H:%M:%S} -} "Oct 23, 1992 00:00:00" -test clock-34.20 {clock scan, ISO 8601 point in time format} { - set time [clock scan "1992-10-23T00:00:00"] - clock format $time -format {%b %d, %Y %H:%M:%S} -} "Oct 23, 1992 00:00:00" -test clock-34.21 {clock scan, ISO 8601 invalid TZ} -body { - set time [clock scan "19921023MST000000"] - clock format $time -format {%b %d, %Y %H:%M:%S} -} -returnCodes error -match glob -result {unable to convert date-time string*} -test clock-34.22 {clock scan, ISO 8601 invalid TZ} -body { - set time [clock scan "19921023M000000"] - clock format $time -format {%b %d, %Y %H:%M:%S} -} -returnCodes error -match glob -result {unable to convert date-time string*} -test clock-34.23 {clock scan, ISO 8601 invalid TZ} -body { - set time [clock scan "1992-10-23M00:00:00"] - clock format $time -format {%b %d, %Y %H:%M:%S} -} -returnCodes error -match glob -result {unable to convert date-time string*} -test clock-34.24 {clock scan, ISO 8601 invalid TZ} -body { - set time [clock scan "1992-10-23MST00:00:00"] - clock format $time -format {%b %d, %Y %H:%M:%S} -} -returnCodes error -match glob -result {unable to convert date-time string*} # CLOCK SCAN REAL TESTS # We use 5am PST, 31-12-1999 as the base for these scans because irrespective @@ -35811,7 +35785,6 @@ test clock-34.43 {last monday in november} { } set res } {1991-11-25 1992-11-30 1993-11-29 1994-11-28 1995-11-27 1996-11-25} - test clock-34.44 {2nd monday in november} { set res {} foreach i {91 92 93 94 95 96} { @@ -35844,38 +35817,95 @@ test clock-34.47 {ago with multiple relative units} { set res [clock scan "2 days 2 hours ago" -base $base] expr {$base - $res} } 180000 - test clock-34.48 {more than one ToD} {*}{ -body {clock scan {10:00 11:00}} -returnCodes error -result {unable to convert date-time string "10:00 11:00": more than one time of day in string} } - test clock-34.49 {more than one date} {*}{ -body {clock scan {1/1/2001 2/2/2002}} -returnCodes error -result {unable to convert date-time string "1/1/2001 2/2/2002": more than one date in string} } - test clock-34.50 {more than one time zone} {*}{ -body {clock scan {10:00 EST CST}} -returnCodes error -result {unable to convert date-time string "10:00 EST CST": more than one time zone in string} } - test clock-34.51 {more than one weekday} {*}{ -body {clock scan {Monday Tuesday}} -returnCodes error -result {unable to convert date-time string "Monday Tuesday": more than one weekday in string} } - test clock-34.52 {more than one ordinal month} {*}{ -body {clock scan {next January next March}} -returnCodes error -result {unable to convert date-time string "next January next March": more than one ordinal month in string} } - - +test clock-34.53 {clock scan, ISO 8601 point in time format} { + set time [clock scan "19921023T00:00:00"] + clock format $time -format {%b %d, %Y %H:%M:%S} +} "Oct 23, 1992 00:00:00" +test clock-34.54 {clock scan, ISO 8601 point in time format} { + set time [clock scan "1992-10-23T00:00:00"] + clock format $time -format {%b %d, %Y %H:%M:%S} +} "Oct 23, 1992 00:00:00" +test clock-34.55 {clock scan, ISO 8601 invalid TZ} -body { + set time [clock scan "19921023MST000000"] + clock format $time -format {%b %d, %Y %H:%M:%S} +} -returnCodes error -match glob -result {unable to convert date-time string*} +test clock-34.56 {clock scan, ISO 8601 invalid TZ} -body { + set time [clock scan "19921023M000000"] + clock format $time -format {%b %d, %Y %H:%M:%S} +} -returnCodes error -match glob -result {unable to convert date-time string*} +test clock-34.57 {clock scan, ISO 8601 invalid TZ} -body { + set time [clock scan "1992-10-23M00:00:00"] + clock format $time -format {%b %d, %Y %H:%M:%S} +} -returnCodes error -match glob -result {unable to convert date-time string*} +test clock-34.58 {clock scan, ISO 8601 invalid TZ} -body { + set time [clock scan "1992-10-23MST00:00:00"] + clock format $time -format {%b %d, %Y %H:%M:%S} +} -returnCodes error -match glob -result {unable to convert date-time string*} +test clock-34.59 {clock scan tests (-TZ)} { + set time [clock scan "31 Jan 14 23:59:59 -0100"] + clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true +} {Feb 01,2014 00:59:59 GMT} +test clock-34.60 {clock scan tests (+TZ)} { + set time [clock scan "31 Jan 14 23:59:59 +0100"] + clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true +} {Jan 31,2014 22:59:59 GMT} +test clock-34.61 {clock scan tests (-TZ)} { + set time [clock scan "23:59:59 -0100" -base 0] + clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true +} {Jan 02,1970 00:59:59 GMT} +test clock-34.62 {clock scan tests (+TZ)} { + set time [clock scan "23:59:59 +0100" -base 0] + clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true +} {Jan 01,1970 22:59:59 GMT} +test clock-34.63 {clock scan tests (TZ)} { + set time [clock scan "Mon, 30 Jun 2014 23:59:59 CEST"] + clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true +} {Jun 30,2014 21:59:59 GMT} +test clock-34.64 {clock scan tests (TZ)} { + set time [clock scan "Fri, 31 Jan 2014 23:59:59 CET"] + clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true +} {Jan 31,2014 22:59:59 GMT} +test clock-34.65 {clock scan tests (relspec, day unit not TZ)} { + set time [clock scan "23:59:59 +15 day" -base 2000000] + clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true +} {Feb 08,1970 22:59:59 GMT} +test clock-34.66 {clock scan tests (relspec, day unit not TZ)} { + set time [clock scan "23:59:59 -15 day" -base 2000000] + clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true +} {Jan 09,1970 22:59:59 GMT} +test clock-34.67 {clock scan tests (merid and TZ)} { + set time [clock scan "10:59 pm CET" -base 2000000] + clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true +} {Jan 24,1970 21:59:00 GMT} +test clock-34.68 {clock scan tests (merid and TZ)} { + set time [clock scan "10:59 pm +0100" -base 2000000] + clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true +} {Jan 24,1970 21:59:00 GMT} # clock seconds test clock-35.1 {clock seconds tests} { @@ -36975,12 +37005,10 @@ test clock-67.2 {Bug d19a30db57} -body { # error, not segfault tcl::clock::GetJulianDayFromEraYearMonthDay {} 2361222 } -returnCodes error -match glob -result * - test clock-67.3 {Bug d19a30db57} -body { # error, not segfault tcl::clock::GetJulianDayFromEraYearWeekDay {} 2361222 } -returnCodes error -match glob -result * - test clock-67.4 {Change format %x output on global locale change [Bug 4a0c163d24]} -setup { package require msgcat set current [msgcat::mclocale] @@ -36992,7 +37020,6 @@ test clock-67.4 {Change format %x output on global locale change [Bug 4a0c163d24 } -cleanup { msgcat::mclocale $current } -result {1 1} - test clock-67.5 {Change scan %x output on global locale change [Bug 4a0c163d24]} -setup { package require msgcat set current [msgcat::mclocale] -- cgit v0.12