summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2018-05-29 17:26:12 (GMT)
committersebres <sebres@users.sourceforge.net>2018-05-29 17:26:12 (GMT)
commit2f35271c9deb7e3091c01e9387440d5ec1f2f09f (patch)
tree67b380fa30ac538925e34ee773951e1178572d61
parent3cf665c0f5505d9c3eec3b6d0c8e5bd0a12f777b (diff)
downloadtcl-2f35271c9deb7e3091c01e9387440d5ec1f2f09f.zip
tcl-2f35271c9deb7e3091c01e9387440d5ec1f2f09f.tar.gz
tcl-2f35271c9deb7e3091c01e9387440d5ec1f2f09f.tar.bz2
fixed week-based calculation if neither mmdd nor ddd available;
-rw-r--r--generic/tclClockFmt.c11
-rw-r--r--generic/tclDate.h3
2 files changed, 11 insertions, 3 deletions
diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c
index 76a78f1..51bac2f 100644
--- a/generic/tclClockFmt.c
+++ b/generic/tclClockFmt.c
@@ -1790,7 +1790,7 @@ static ClockScanTokenMap ScnSTokenMap[] = {
{CTOKT_INT, CLF_ISO8601WEAK, 0, 1, 2, TclOffset(DateInfo, date.iso8601Week),
NULL},
/* %a %A %u %w */
- {CTOKT_PARSER, CLF_DAYOFWEEK | CLF_ISO8601WEAK, 0, 0, 0xffff, 0,
+ {CTOKT_PARSER, CLF_DAYOFWEEK, 0, 0, 0xffff, 0,
ClockScnToken_DayOfWeek_Proc, NULL},
/* %z %Z */
{CTOKT_PARSER, CLF_OPTIONAL, 0, 0, 0xffff, 0,
@@ -1854,7 +1854,7 @@ static ClockScanTokenMap ScnOTokenMap[] = {
{CTOKT_PARSER, CLF_TIME, 0, 0, 0xffff, TclOffset(DateInfo, date.secondOfMin),
ClockScnToken_LocaleListMatcher_Proc, (void *)MCLIT_LOCALE_NUMERALS},
/* %Ou Ow */
- {CTOKT_PARSER, CLF_DAYOFWEEK | CLF_ISO8601WEAK, 0, 0, 0xffff, 0,
+ {CTOKT_PARSER, CLF_DAYOFWEEK, 0, 0, 0xffff, 0,
ClockScnToken_DayOfWeek_Proc, (void *)MCLIT_LOCALE_NUMERALS},
};
static const char *ScnOTokenMapAliasIndex[2] = {
@@ -2336,6 +2336,13 @@ ClockScan(
flags &= ~CLF_ISO8601WEAK;
}
break;
+ /* neither mmdd nor ddd available */
+ case 0:
+ /* but we have day of the week, which can be used */
+ if (flags & CLF_DAYOFWEEK) {
+ /* prefer week based calculation of julianday */
+ flags |= CLF_ISO8601WEAK;
+ }
}
/* YearWeekDay below YearMonthDay */
diff --git a/generic/tclDate.h b/generic/tclDate.h
index 9ce5dc8..1054b145 100644
--- a/generic/tclDate.h
+++ b/generic/tclDate.h
@@ -53,7 +53,8 @@
#define CLF_ASSEMBLE_SECONDS (1 << 30) /* assemble localSeconds (and seconds at end) */
#define CLF_DATE (CLF_JULIANDAY | CLF_DAYOFMONTH | CLF_DAYOFYEAR | \
- CLF_MONTH | CLF_YEAR | CLF_ISO8601YEAR | CLF_ISO8601WEAK)
+ CLF_MONTH | CLF_YEAR | CLF_ISO8601YEAR | \
+ CLF_DAYOFWEEK | CLF_ISO8601WEAK)
/*
* Enumeration of the string literals used in [clock]