Tcl Source Code

Check-in [b9804722b9]
Login
Bounty program for improvements to Tcl and certain Tcl packages.

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

Overview
Comment:implemented scan of astronomical julian day (JDN/ID) with token `%Ej`, corresponds julian date of sqlite-database. In opposite to calendar julian day `%J`, it starts the day at noon (and can parse float, so contains a time fraction). **TODO** implement `clock format ... -format %Ej` and test-cases for format of this token. **TODO** implement `%EJ` token for calendar JD with time fraction.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | clock-astronomical-jdn
Files: files | file ages | folders
SHA3-256: b9804722b9f22a9c18ffebc3a9d0b620658890afb39c34ddca3b2ddc0f6f7947
User & Date: sebres 2019-03-13 00:21:13
Context
2019-03-13
00:23
scan: extended with token `%EJ` to scan calendar julian day with time fraction (in opposite to astro... check-in: 9095503f61 user: sebres tags: clock-astronomical-jdn
00:21
implemented scan of astronomical julian day (JDN/ID) with token `%Ej`, corresponds julian date of sq... check-in: b9804722b9 user: sebres tags: clock-astronomical-jdn
2019-03-05
22:58
merge 8.6 - timerate is part of Tcl now (since TIP#527 got merged), conflicts resolved, tclDate.c re... check-in: 3454e26373 user: sebres tags: sebres-8-6-clock-speedup-cr2
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to doc/clock.n.

396
397
398
399
400
401
402



403
404
405
406
407
408
409
...
546
547
548
549
550
551
552













553
554
555
556
557
558
559
...
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
preprocessed format string.  In order of preference:
.IP [1]
If the string contains a \fB%s\fR format group, representing
seconds from the epoch, that group is used to determine the date.
.IP [2]
If the string contains a \fB%J\fR format group, representing
the Julian Day Number, that group is used to determine the date.



.IP [3]
If the string contains a complete set of format groups specifying
century, year, month, and day of month; century, year, and day of year;
or ISO8601 fiscal year, week of year, and day of week; those groups are
combined and used to determine the date.  If more than one complete
set is present, the one at the rightmost position in the string is
used.
................................................................................
string of the same meaning in the locale, to indicate whether \fB%Y\fR refers
to years before or after Year 1 of the Common Era.  On input, accepts
the string \fBB.C.E.\fR, \fBB.C.\fR, \fBC.E.\fR, \fBA.D.\fR, or the
abbreviation appropriate to the current locale, and uses it to fix
whether \fB%Y\fR refers to years before or after Year 1 of the
Common Era.
.TP













\fB%Es\fR
This affects similar to \fB%s\fR, but in opposition to \fB%s\fR it parses
or formats local seconds (not the posix seconds).
Because \fB%s\fR has the same precedence as \fB%s\fR (uniquely determines 
a point in time), it overrides all other input formats.
.TP
\fB%Ex\fR
................................................................................
(12-11) on a 12-hour clock.  On input, accepts such a number.
.TP
\fB%j\fR
On output, produces a three-digit number giving the day of the year
(001-366).  On input, accepts such a number.
.TP
\fB%J\fR
On output, produces a string of digits giving the Julian Day Number.
On input, accepts a string of digits and interprets it as a Julian Day Number.
The Julian Day Number is a count of the number of calendar days
that have elapsed since 1 January, 4713 BCE of the proleptic
Julian calendar.  The epoch time of 1 January 1970 corresponds
to Julian Day Number 2440588.
.TP
\fB%k\fR






>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>







 







|







396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
...
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
...
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
preprocessed format string.  In order of preference:
.IP [1]
If the string contains a \fB%s\fR format group, representing
seconds from the epoch, that group is used to determine the date.
.IP [2]
If the string contains a \fB%J\fR format group, representing
the Julian Day Number, that group is used to determine the date.
Note, that in case of \fB%Ej\fR format group, representing
the astronomical Julian Date (with time fraction), this group is used
to determine the date and time.
.IP [3]
If the string contains a complete set of format groups specifying
century, year, month, and day of month; century, year, and day of year;
or ISO8601 fiscal year, week of year, and day of week; those groups are
combined and used to determine the date.  If more than one complete
set is present, the one at the rightmost position in the string is
used.
................................................................................
string of the same meaning in the locale, to indicate whether \fB%Y\fR refers
to years before or after Year 1 of the Common Era.  On input, accepts
the string \fBB.C.E.\fR, \fBB.C.\fR, \fBC.E.\fR, \fBA.D.\fR, or the
abbreviation appropriate to the current locale, and uses it to fix
whether \fB%Y\fR refers to years before or after Year 1 of the
Common Era.
.TP
\fB%Ej\fR
On output, produces a string of digits giving the Astronomical Julian Date or
Astronomical Julian Day Number (JDN/JD). In opposite to calendar julian day
\fB%J\fR, it starts the day at noon.
On input, accepts a string of digits (or floating point with the time fraction)
and interprets it as an Astronomical Julian Day Number (JDN/JD).
The Astronomical Julian Date is a count of the number of calendar days
that have elapsed since 1 January, 4713 BCE of the proleptic
Julian calendar, which contains also the time fraktion (after floating point).
The epoch time of 1 January 1970 corresponds to Astronomical JDN 2440587.5.
This value corresponds the julian day used in sqlite-database, and is the same
as result of \fBselect julianday(:seconds, 'unixepoch')\fR.
.TP
\fB%Es\fR
This affects similar to \fB%s\fR, but in opposition to \fB%s\fR it parses
or formats local seconds (not the posix seconds).
Because \fB%s\fR has the same precedence as \fB%s\fR (uniquely determines 
a point in time), it overrides all other input formats.
.TP
\fB%Ex\fR
................................................................................
(12-11) on a 12-hour clock.  On input, accepts such a number.
.TP
\fB%j\fR
On output, produces a three-digit number giving the day of the year
(001-366).  On input, accepts such a number.
.TP
\fB%J\fR
On output, produces a string of digits giving the calendar Julian Day Number.
On input, accepts a string of digits and interprets it as a Julian Day Number.
The Julian Day Number is a count of the number of calendar days
that have elapsed since 1 January, 4713 BCE of the proleptic
Julian calendar.  The epoch time of 1 January 1970 corresponds
to Julian Day Number 2440588.
.TP
\fB%k\fR

Changes to generic/tclClock.c.

231
232
233
234
235
236
237
238

239
240
241
242
243
244
245
....
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
....
3715
3716
3717
3718
3719
3720
3721
3722


3723
3724
3725
3726
3727
3728
3729
3730
    data->mcLitIdxs = NULL;
    data->mcDicts = NULL;
    data->lastTZEpoch = 0;
    data->currentYearCentury = ClockDefaultYearCentury;
    data->yearOfCenturySwitch = ClockDefaultCenturySwitch;
    data->validMinYear = INT_MIN;
    data->validMaxYear = INT_MAX;
    data->maxJulianDay = 5373484; /* corresponds 9999-12-31 23:59:59 per default */


    data->systemTimeZone = NULL;
    data->systemSetupTZData = NULL;
    data->gmtSetupTimeZoneUnnorm = NULL;
    data->gmtSetupTimeZone = NULL;
    data->gmtSetupTZData = NULL;
    data->gmtTZName = NULL;
................................................................................
	    if (i+1 >= objc) {
		Tcl_SetObjResult(interp,
		    Tcl_NewIntObj(dataPtr->validMaxYear));
	    }
	break;
	case CLOCK_MAX_JDN:
	    if (i < objc) {
		Tcl_WideInt jd;
		if (TclGetWideIntFromObj(interp, objv[i], &jd) != TCL_OK) {
		    return TCL_ERROR;
		}
		dataPtr->maxJulianDay = jd;
		Tcl_SetObjResult(interp, objv[i]);
		continue;
	    }
	    if (i+1 >= objc) {
		Tcl_SetObjResult(interp,
		    Tcl_NewWideIntObj(dataPtr->maxJulianDay));
	    }
	break;
	case CLOCK_VALIDATE:
	    if (i < objc) {
		int val;
		if (Tcl_GetBooleanFromObj(interp, objv[i], &val) != TCL_OK) {
		    return TCL_ERROR;
................................................................................
	}
	info->flags |= CLF_ASSEMBLE_SECONDS;
	info->flags &= ~CLF_ASSEMBLE_JULIANDAY;
    }

    /* some overflow checks */
    if (info->flags & CLF_JULIANDAY) {
    	ClockClientData *dataPtr = opts->clientData;


    	if (yydate.julianDay > dataPtr->maxJulianDay) {
	    Tcl_SetObjResult(opts->interp, Tcl_NewStringObj(
		"requested date too large to represent", -1));
	    Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL);
	    return TCL_ERROR;
	}
    }







|
>







 







|
|


|





|







 







|
>
>
|







231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
....
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
....
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
    data->mcLitIdxs = NULL;
    data->mcDicts = NULL;
    data->lastTZEpoch = 0;
    data->currentYearCentury = ClockDefaultYearCentury;
    data->yearOfCenturySwitch = ClockDefaultCenturySwitch;
    data->validMinYear = INT_MIN;
    data->validMaxYear = INT_MAX;
    /* corresponds max of JDN in sqlite - 9999-12-31 23:59:59 per default */
    data->maxJDN = 5373484.499999994; 

    data->systemTimeZone = NULL;
    data->systemSetupTZData = NULL;
    data->gmtSetupTimeZoneUnnorm = NULL;
    data->gmtSetupTimeZone = NULL;
    data->gmtSetupTZData = NULL;
    data->gmtTZName = NULL;
................................................................................
	    if (i+1 >= objc) {
		Tcl_SetObjResult(interp,
		    Tcl_NewIntObj(dataPtr->validMaxYear));
	    }
	break;
	case CLOCK_MAX_JDN:
	    if (i < objc) {
		double jd;
		if (Tcl_GetDoubleFromObj(interp, objv[i], &jd) != TCL_OK) {
		    return TCL_ERROR;
		}
		dataPtr->maxJDN = jd;
		Tcl_SetObjResult(interp, objv[i]);
		continue;
	    }
	    if (i+1 >= objc) {
		Tcl_SetObjResult(interp,
		    Tcl_NewDoubleObj(dataPtr->maxJDN));
	    }
	break;
	case CLOCK_VALIDATE:
	    if (i < objc) {
		int val;
		if (Tcl_GetBooleanFromObj(interp, objv[i], &val) != TCL_OK) {
		    return TCL_ERROR;
................................................................................
	}
	info->flags |= CLF_ASSEMBLE_SECONDS;
	info->flags &= ~CLF_ASSEMBLE_JULIANDAY;
    }

    /* some overflow checks */
    if (info->flags & CLF_JULIANDAY) {
	ClockClientData *dataPtr = opts->clientData;
	double curJDN = (double)yydate.julianDay
	    + ((double)yySecondOfDay - SECONDS_PER_DAY/2) / SECONDS_PER_DAY;
	if (curJDN > dataPtr->maxJDN) {
	    Tcl_SetObjResult(opts->interp, Tcl_NewStringObj(
		"requested date too large to represent", -1));
	    Tcl_SetErrorCode(opts->interp, "CLOCK", "dateTooLarge", NULL);
	    return TCL_ERROR;
	}
    }

Changes to generic/tclClockFmt.c.

1578
1579
1580
1581
1582
1583
1584


























































1585
1586
1587
1588
1589
1590
1591
....
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822



1823
1824
1825
1826
1827
1828
1829
    if (tok->map->offs > 0) {
	*(int *)(((char *)info) + tok->map->offs) = --val;
    }

    return TCL_OK;
}


























































 
static int
ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts,
    DateInfo *info, ClockScanToken *tok)
{
    int minLen, maxLen;
    int len = 0;
................................................................................
};
static const char *ScnSTokenMapAliasIndex[2] = {
    "eNBhkIlPAuwZW",
    "dmbbHHHpaaazU"
};

static const char *ScnETokenMapIndex =
    "Eys";
static ClockScanTokenMap ScnETokenMap[] = {
    /* %EE */
    {CTOKT_PARSER, 0, 0, 0, 0xffff, TclOffset(DateInfo, date.year),
	ClockScnToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS},



    /* %Ey */
    {CTOKT_PARSER, 0, 0, 0, 0xffff, 0, /* currently no capture, parse only token */
	ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS},
    /* %Es */
    {CTOKT_WIDE, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds),
	NULL},
};






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







|




>
>
>







1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
....
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
    if (tok->map->offs > 0) {
	*(int *)(((char *)info) + tok->map->offs) = --val;
    }

    return TCL_OK;
}
 
static int
ClockScnToken_AstroJDN_Proc(ClockFmtScnCmdArgs *opts,
    DateInfo *info, ClockScanToken *tok)
{
    int minLen, maxLen;
    register const char *p = yyInput, *end; const char *s;
    Tcl_WideInt intJD; int fractJD = 0, fractJDDiv = 1;

    DetermineGreedySearchLen(opts, info, tok, &minLen, &maxLen);

    end = yyInput + maxLen;

    /* currently positive astronomic dates only */
    if (*p == '+') { p++; };
    s = p;
    while (p < end && isdigit(UCHAR(*p))) {
	p++;
    }
    if ( _str2wideInt(&intJD, s, p, 1) != TCL_OK) {
	return TCL_RETURN;
    };
    yyInput = p;
    if (p >= end || *p++ != '.') { /* allow pure integer astronomical JDN */
	goto done;
    }
    s = p;
    while (p < end && isdigit(UCHAR(*p))) {
    	fractJDDiv *= 10;
	p++;
    }
    if ( _str2int(&fractJD, s, p, 1) != TCL_OK) {
	return TCL_RETURN;
    };
    yyInput = p;

done:
    /* 
     * Build a date from julian day (integer and fraction).
     * Note, astronomical JDN starts at noon in opposite to calendar julianday.
     */

    fractJD = (SECONDS_PER_DAY/2)
	+ (int)((Tcl_WideInt)SECONDS_PER_DAY * fractJD / fractJDDiv);
    if (fractJD > SECONDS_PER_DAY) {
	fractJD %= SECONDS_PER_DAY;
	intJD += 1;
    }   
    yydate.secondOfDay = fractJD;
    yydate.julianDay = intJD;

    yydate.seconds =
	-210866803200L
	+ ( SECONDS_PER_DAY * intJD )
	+ ( fractJD );

    return TCL_OK;
}
 
static int
ClockScnToken_TimeZone_Proc(ClockFmtScnCmdArgs *opts,
    DateInfo *info, ClockScanToken *tok)
{
    int minLen, maxLen;
    int len = 0;
................................................................................
};
static const char *ScnSTokenMapAliasIndex[2] = {
    "eNBhkIlPAuwZW",
    "dmbbHHHpaaazU"
};

static const char *ScnETokenMapIndex =
    "Ejys";
static ClockScanTokenMap ScnETokenMap[] = {
    /* %EE */
    {CTOKT_PARSER, 0, 0, 0, 0xffff, TclOffset(DateInfo, date.year),
	ClockScnToken_LocaleERA_Proc, (void *)MCLIT_LOCALE_NUMERALS},
    /* %Ej */
    {CTOKT_PARSER, CLF_JULIANDAY | CLF_POSIXSEC | CLF_SIGNED, 0, 1, 0xffff, 0,
	ClockScnToken_AstroJDN_Proc, NULL},
    /* %Ey */
    {CTOKT_PARSER, 0, 0, 0, 0xffff, 0, /* currently no capture, parse only token */
	ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS},
    /* %Es */
    {CTOKT_WIDE, CLF_LOCALSEC | CLF_SIGNED, 0, 1, 0xffff, TclOffset(DateInfo, date.localSeconds),
	NULL},
};

Changes to generic/tclDate.h.

306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
    /* Cache for current clock parameters, imparted via "configure" */
    size_t lastTZEpoch;
    int currentYearCentury;
    int yearOfCenturySwitch;
    int validMinYear;
    int validMaxYear;
    Tcl_WideInt maxJulianDay;

    Tcl_Obj *systemTimeZone;
    Tcl_Obj *systemSetupTZData;
    Tcl_Obj *gmtSetupTimeZoneUnnorm;
    Tcl_Obj *gmtSetupTimeZone;
    Tcl_Obj *gmtSetupTZData;
    Tcl_Obj *gmtTZName;






|







306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
    /* Cache for current clock parameters, imparted via "configure" */
    size_t lastTZEpoch;
    int currentYearCentury;
    int yearOfCenturySwitch;
    int validMinYear;
    int validMaxYear;
    double maxJDN;

    Tcl_Obj *systemTimeZone;
    Tcl_Obj *systemSetupTZData;
    Tcl_Obj *gmtSetupTimeZoneUnnorm;
    Tcl_Obj *gmtSetupTimeZone;
    Tcl_Obj *gmtSetupTZData;
    Tcl_Obj *gmtTZName;

Changes to tests/clock.test.

18896
18897
18898
18899
18900
18901
18902


































































18903
18904
18905
18906
18907
18908
18909
.....
21309
21310
21311
21312
21313
21314
21315



21316
21317
21318
21319
21320
21321
21322
	[clock scan {0 2440589} -format {%s %J} -gmt true]
} {86400 0 86400 0}

test clock-7.9 {Julian Day, two values} {
    clock scan {2440588 2440589} -format {%J %J} -gmt true
} 86400



































































# BEGIN testcases8

# Test parsing of ccyymmdd

test clock-8.1 {parse ccyymmdd} {
    clock scan {1970 Jan 02} -format {%C%y %b %d} -locale en_US_roman -gmt 1
} 86400
................................................................................
test clock-9.1 {seconds take precedence over ccyymmdd} {
    clock scan {0 20000101} -format {%s %Y%m%d} -gmt true
} 0

test clock-9.2 {Julian day takes precedence over ccyymmdd} {
    clock scan {2440588 20000101} -format {%J %Y%m%d} -gmt true
} 0




# Test parsing of ccyyddd

test clock-10.1 {parse ccyyddd} {
    clock scan {1970 001} -format {%Y %j} -locale en_US_roman -gmt 1
} 0
test clock-10.2 {parse ccyyddd} {






>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>
>
>







18896
18897
18898
18899
18900
18901
18902
18903
18904
18905
18906
18907
18908
18909
18910
18911
18912
18913
18914
18915
18916
18917
18918
18919
18920
18921
18922
18923
18924
18925
18926
18927
18928
18929
18930
18931
18932
18933
18934
18935
18936
18937
18938
18939
18940
18941
18942
18943
18944
18945
18946
18947
18948
18949
18950
18951
18952
18953
18954
18955
18956
18957
18958
18959
18960
18961
18962
18963
18964
18965
18966
18967
18968
18969
18970
18971
18972
18973
18974
18975
.....
21375
21376
21377
21378
21379
21380
21381
21382
21383
21384
21385
21386
21387
21388
21389
21390
21391
	[clock scan {0 2440589} -format {%s %J} -gmt true]
} {86400 0 86400 0}

test clock-7.9 {Julian Day, two values} {
    clock scan {2440588 2440589} -format {%J %J} -gmt true
} 86400


test clock-7.11 {Astronomical JDN/JD} {
    clock scan 0 -format %Ej -gmt true
} -210866760000

test clock-7.12 {Astronomical JDN/JD} {
    clock format [clock scan 2440587.5 -format %Ej -gmt true] \
	-format "%Y-%m-%d %T" -gmt true
} "1970-01-01 00:00:00"

test clock-7.13 {Astronomical JDN/JD} {
    clock format [clock scan 2451544.5 -format %Ej -gmt true] \
	-format "%Y-%m-%d %T" -gmt true
} "2000-01-01 00:00:00"

test clock-7.13.1 {Astronomical JDN/JD} {
    clock format [clock scan 2488069.5 -format %Ej -gmt true] \
	-format "%Y-%m-%d %T" -gmt true
} "2100-01-01 00:00:00"

test clock-7.14 {Astronomical JDN/JD} {
    clock format [clock scan 5373483.5 -format %Ej -gmt true] \
	-format "%Y-%m-%d %T" -gmt true
} "9999-12-31 00:00:00"

test clock-7.14.1 {Astronomical JDN/JD} {
    clock format [clock scan 5373484 -format %Ej -gmt true] \
	-format "%Y-%m-%d %T" -gmt true
} "9999-12-31 12:00:00"
test clock-7.14.2 {Astronomical JDN/JD} {
    clock format [clock scan 5373484.49999 -format %Ej -gmt true] \
	-format "%Y-%m-%d %T" -gmt true
} "9999-12-31 23:59:59"

test clock-7.15 {Astronomical JDN/JD, bad} {
    list [catch {
	clock scan bogus -format %Ej
    } result] $result $errorCode
} {1 {input string does not match supplied format} {CLOCK badInputString}}

test clock-7.16 {Astronomical JDN/JD, overflow} {
    list [catch {
	clock scan 5373484.5 -format %Ej
    } result] $result $errorCode \
    [catch {
	clock scan 5373485 -format %Ej
    } result] $result $errorCode \
    [catch {
	clock scan 2147483648 -format %Ej
    } result] $result $errorCode \
    [catch {
	clock scan 2147483648.5 -format %Ej
    } result] $result $errorCode
} [lrepeat 4 1 {requested date too large to represent} {CLOCK dateTooLarge}]

test clock-7.18 {Astronomical JDN/JD, same precedence as seconds (last wins} {
    list [clock scan {2440588 86400} -format {%Ej %s} -gmt true] \
	[clock scan {2440589 0} -format {%Ej %s} -gmt true] \
	[clock scan {86400 2440588} -format {%s %Ej} -gmt true] \
	[clock scan {0 2440589} -format {%s %Ej} -gmt true]
} {86400 0 43200 129600}

test clock-7.19 {Astronomical JDN/JD, two values} {
    clock scan {2440588 2440589} -format {%Ej %Ej} -gmt true
} 129600

# BEGIN testcases8

# Test parsing of ccyymmdd

test clock-8.1 {parse ccyymmdd} {
    clock scan {1970 Jan 02} -format {%C%y %b %d} -locale en_US_roman -gmt 1
} 86400
................................................................................
test clock-9.1 {seconds take precedence over ccyymmdd} {
    clock scan {0 20000101} -format {%s %Y%m%d} -gmt true
} 0

test clock-9.2 {Julian day takes precedence over ccyymmdd} {
    clock scan {2440588 20000101} -format {%J %Y%m%d} -gmt true
} 0
test clock-9.2.1 {Astro julian day takes precedence over date-time} {
    clock scan {2440587.5 20000101 010203} -format {%Ej %Y%m%d %H%M%S} -gmt true
} 0

# Test parsing of ccyyddd

test clock-10.1 {parse ccyyddd} {
    clock scan {1970 001} -format {%Y %j} -locale en_US_roman -gmt 1
} 0
test clock-10.2 {parse ccyyddd} {