summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2017-01-10 22:31:12 (GMT)
committersebres <sebres@users.sourceforge.net>2017-01-10 22:31:12 (GMT)
commit767da780e6fab9b52c9cbe460f6b3101910367e9 (patch)
tree8d32f1c6321349745652998dd8e2594e4532bb05
parentf6b32c8442a436357885e7193724581862452a11 (diff)
downloadtcl-767da780e6fab9b52c9cbe460f6b3101910367e9.zip
tcl-767da780e6fab9b52c9cbe460f6b3101910367e9.tar.gz
tcl-767da780e6fab9b52c9cbe460f6b3101910367e9.tar.bz2
seconds token (%s) take precedence over all other tokens
-rw-r--r--generic/tclClockFmt.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/generic/tclClockFmt.c b/generic/tclClockFmt.c
index 09cbfa4..ba924fd 100644
--- a/generic/tclClockFmt.c
+++ b/generic/tclClockFmt.c
@@ -1147,41 +1147,47 @@ ClockScan(
goto not_match;
}
- /* invalidate result */
- if (flags & CLF_DATE) {
+ /*
+ * Invalidate result
+ */
+
+ /* seconds token (%s) take precedence over all other tokens */
+ if ((opts->flags & CLF_EXTENDED) || !(flags & CLF_LOCALSEC)) {
+ if (flags & CLF_DATE) {
- if (!(flags & CLF_JULIANDAY)) {
- info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY;
+ if (!(flags & CLF_JULIANDAY)) {
+ info->flags |= CLF_INVALIDATE_SECONDS|CLF_INVALIDATE_JULIANDAY;
- if (yyYear < 100) {
- if (!(flags & CLF_CENTURY)) {
- if (yyYear >= dataPtr->yearOfCenturySwitch) {
- yyYear -= 100;
+ if (yyYear < 100) {
+ if (!(flags & CLF_CENTURY)) {
+ if (yyYear >= dataPtr->yearOfCenturySwitch) {
+ yyYear -= 100;
+ }
+ yyYear += dataPtr->currentYearCentury;
+ } else {
+ yyYear += info->dateCentury * 100;
}
- yyYear += dataPtr->currentYearCentury;
- } else {
- yyYear += info->dateCentury * 100;
}
+ yydate.era = CE;
+ }
+ /* if date but no time - reset time */
+ if (!(flags & (CLF_TIME|CLF_LOCALSEC))) {
+ info->flags |= CLF_INVALIDATE_SECONDS;
+ yydate.localSeconds = 0;
}
- yydate.era = CE;
}
- /* if date but no time - reset time */
- if (!(flags & (CLF_TIME|CLF_LOCALSEC))) {
+
+ if (flags & CLF_TIME) {
+ info->flags |= CLF_INVALIDATE_SECONDS;
+ yySeconds = ToSeconds(yyHour, yyMinutes,
+ yySeconds, yyMeridian);
+ } else
+ if (!(flags & CLF_LOCALSEC)) {
info->flags |= CLF_INVALIDATE_SECONDS;
- yydate.localSeconds = 0;
+ yySeconds = yydate.localSeconds % SECONDS_PER_DAY;
}
}
- if (flags & CLF_TIME) {
- info->flags |= CLF_INVALIDATE_SECONDS;
- yySeconds = ToSeconds(yyHour, yyMinutes,
- yySeconds, yyMeridian);
- } else
- if (!(flags & CLF_LOCALSEC)) {
- info->flags |= CLF_INVALIDATE_SECONDS;
- yySeconds = yydate.localSeconds % SECONDS_PER_DAY;
- }
-
ret = TCL_OK;
goto done;