-/* Generated by re2c 0.9.10.dev on Sat Oct 8 16:29:08 2005 */
+/* Generated by re2c 0.9.10.dev on Wed Oct 19 22:39:08 2005 */
#line 1 "resource/parse_date.re"
/*
+----------------------------------------------------------------------+
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; }
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
#define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y = 0; }
-#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
+#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; s->time->relative.weekday_behavior = 0; }
#define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_weekday_relative = 1; }
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { return TIMELIB_ERROR; } else { s->time.have_zone = 1; } }
{ "twelfth", 0, 12 },
{ "last", 0, -1 },
{ "previous", 0, -1 },
- { "this", 0, 0 },
- { NULL, 0, 0 }
+ { "this", 1, 0 },
+ { NULL, 1, 0 }
};
/* The month table. */
return 0;
}
-static timelib_sll timelib_lookup_relative_text(char **ptr)
+static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
{
char *word;
char *begin = *ptr, *end;
for (tp = timelib_reltext_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
value = tp->value;
+ *behavior = tp->type;
}
}
return value;
}
-static timelib_sll timelib_get_relative_text(char **ptr)
+static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
{
while (**ptr == ' ' || **ptr == '-' || **ptr == '/') {
++*ptr;
}
- return timelib_lookup_relative_text(ptr);
+ return timelib_lookup_relative_text(ptr, behavior);
}
static long timelib_lookup_month(char **ptr)
return value;
}
-static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
+static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, Scanner *s)
{
const timelib_relunit* relunit;
TIMELIB_UNHAVE_TIME();
s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
s->time->relative.weekday = relunit->multiplier;
+ s->time->relative.weekday_behavior = behavior;
break;
}
}
std:
s->tok = cursor;
s->len = 0;
-#line 800 "resource/parse_date.re"
+#line 802 "resource/parse_date.re"
{
0, 0, 0, 0, 0, 0, 0, 0,
};
-#line 736 "<stdout>"
+#line 738 "<stdout>"
{
YYCTYPE yych;
unsigned int yyaccept;
yy3:
YYDEBUG(3, *YYCURSOR);
-#line 1296 "resource/parse_date.re"
+#line 1300 "resource/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("tzcorrection | tz");
TIMELIB_DEINIT;
return TIMELIB_TIMEZONE;
}
-#line 824 "<stdout>"
+#line 826 "<stdout>"
yy4:
YYDEBUG(4, *YYCURSOR);
yych = *++YYCURSOR;
yy8:
YYDEBUG(8, *YYCURSOR);
-#line 1362 "resource/parse_date.re"
+#line 1366 "resource/parse_date.re"
{
/* printf("unexpected character: #%d, %c ", *s->tok, *s->tok); */
s->errors++;
goto std;
}
-#line 929 "<stdout>"
+#line 931 "<stdout>"
yy9:
YYDEBUG(9, *YYCURSOR);
yyaccept = 0;
yy44:
YYDEBUG(44, *YYCURSOR);
-#line 1351 "resource/parse_date.re"
+#line 1355 "resource/parse_date.re"
{
goto std;
}
-#line 1765 "<stdout>"
+#line 1767 "<stdout>"
yy45:
YYDEBUG(45, *YYCURSOR);
++YYCURSOR;
yy46:
YYDEBUG(46, *YYCURSOR);
-#line 1356 "resource/parse_date.re"
+#line 1360 "resource/parse_date.re"
{
s->pos = cursor; s->line++;
goto std;
}
-#line 1774 "<stdout>"
+#line 1776 "<stdout>"
yy47:
YYDEBUG(47, *YYCURSOR);
yych = *++YYCURSOR;
yy85:
YYDEBUG(85, *YYCURSOR);
-#line 1335 "resource/parse_date.re"
+#line 1339 "resource/parse_date.re"
{
timelib_ull i;
DEBUG_OUTPUT("relative");
while(*ptr) {
i = timelib_get_unsigned_nr((char **) &ptr, 24);
timelib_eat_spaces((char **) &ptr);
- timelib_set_relative((char **) &ptr, i, s);
+ timelib_set_relative((char **) &ptr, i, 0, s);
}
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 2164 "<stdout>"
+#line 2166 "<stdout>"
yy86:
YYDEBUG(86, *YYCURSOR);
++YYCURSOR;
yy151:
YYDEBUG(151, *YYCURSOR);
-#line 1290 "resource/parse_date.re"
+#line 1294 "resource/parse_date.re"
{
DEBUG_OUTPUT("dayabbr");
goto std;
}
-#line 2728 "<stdout>"
+#line 2730 "<stdout>"
yy152:
YYDEBUG(152, *YYCURSOR);
yyaccept = 1;
yy158:
YYDEBUG(158, *YYCURSOR);
-#line 1274 "resource/parse_date.re"
+#line 1277 "resource/parse_date.re"
{
const timelib_relunit* relunit;
DEBUG_OUTPUT("dayfull");
relunit = timelib_lookup_relunit((char**) &ptr);
s->time->relative.weekday = relunit->multiplier;
+ s->time->relative.weekday_behavior = 1;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 2768 "<stdout>"
+#line 2771 "<stdout>"
yy159:
YYDEBUG(159, *YYCURSOR);
yyaccept = 1;
yy190:
YYDEBUG(190, *YYCURSOR);
-#line 1258 "resource/parse_date.re"
+#line 1260 "resource/parse_date.re"
{
timelib_sll i;
+ int behavior;
DEBUG_OUTPUT("relativetext");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
while(*ptr) {
- i = timelib_get_relative_text((char **) &ptr);
+ i = timelib_get_relative_text((char **) &ptr, &behavior);
timelib_eat_spaces((char **) &ptr);
- timelib_set_relative((char **) &ptr, i, s);
+ timelib_set_relative((char **) &ptr, i, behavior, s);
}
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 3086 "<stdout>"
+#line 3090 "<stdout>"
yy191:
YYDEBUG(191, *YYCURSOR);
++YYCURSOR;
yy509:
YYDEBUG(509, *YYCURSOR);
-#line 1080 "resource/parse_date.re"
+#line 1082 "resource/parse_date.re"
{
DEBUG_OUTPUT("datetextual | datenoyear");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 8079 "<stdout>"
+#line 8083 "<stdout>"
yy510:
YYDEBUG(510, *YYCURSOR);
yych = *++YYCURSOR;
yy527:
YYDEBUG(527, *YYCURSOR);
-#line 1307 "resource/parse_date.re"
+#line 1311 "resource/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("dateshortwithtimeshort | dateshortwithtimelong | dateshortwithtimelongtz");
TIMELIB_DEINIT;
return TIMELIB_SHORTDATE_WITH_TIME;
}
-#line 8230 "<stdout>"
+#line 8234 "<stdout>"
yy528:
YYDEBUG(528, *YYCURSOR);
yyaccept = 7;
yy562:
YYDEBUG(562, *YYCURSOR);
-#line 1054 "resource/parse_date.re"
+#line 1056 "resource/parse_date.re"
{
DEBUG_OUTPUT("datenoday");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 8485 "<stdout>"
+#line 8489 "<stdout>"
yy563:
YYDEBUG(563, *YYCURSOR);
yyaccept = 6;
yy588:
YYDEBUG(588, *YYCURSOR);
-#line 1189 "resource/parse_date.re"
+#line 1191 "resource/parse_date.re"
{
DEBUG_OUTPUT("pgtextshort");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 8744 "<stdout>"
+#line 8748 "<stdout>"
yy589:
YYDEBUG(589, *YYCURSOR);
yych = *++YYCURSOR;
yy684:
YYDEBUG(684, *YYCURSOR);
-#line 1243 "resource/parse_date.re"
+#line 1245 "resource/parse_date.re"
{
DEBUG_OUTPUT("ago");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_AGO;
}
-#line 10069 "<stdout>"
+#line 10073 "<stdout>"
yy685:
YYDEBUG(685, *YYCURSOR);
yyaccept = 1;
yy788:
YYDEBUG(788, *YYCURSOR);
-#line 1093 "resource/parse_date.re"
+#line 1095 "resource/parse_date.re"
{
DEBUG_OUTPUT("datenoyearrev");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_DATE_TEXT;
}
-#line 11802 "<stdout>"
+#line 11806 "<stdout>"
yy789:
YYDEBUG(789, *YYCURSOR);
yyaccept = 10;
yy799:
YYDEBUG(799, *YYCURSOR);
-#line 884 "resource/parse_date.re"
+#line 886 "resource/parse_date.re"
{
DEBUG_OUTPUT("timetiny12 | timeshort12 | timelong12");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_TIME12;
}
-#line 11906 "<stdout>"
+#line 11910 "<stdout>"
yy800:
YYDEBUG(800, *YYCURSOR);
yych = *++YYCURSOR;
yy802:
YYDEBUG(802, *YYCURSOR);
-#line 901 "resource/parse_date.re"
+#line 903 "resource/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("timeshort24 | timelong24 | iso8601long");
TIMELIB_DEINIT;
return TIMELIB_TIME24_WITH_ZONE;
}
-#line 11943 "<stdout>"
+#line 11947 "<stdout>"
yy803:
YYDEBUG(803, *YYCURSOR);
yyaccept = 11;
yy828:
YYDEBUG(828, *YYCURSOR);
-#line 1028 "resource/parse_date.re"
+#line 1030 "resource/parse_date.re"
{
DEBUG_OUTPUT("datefull");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL;
}
-#line 12146 "<stdout>"
+#line 12150 "<stdout>"
yy829:
YYDEBUG(829, *YYCURSOR);
yych = *++YYCURSOR;
yy897:
YYDEBUG(897, *YYCURSOR);
-#line 1041 "resource/parse_date.re"
+#line 1043 "resource/parse_date.re"
{
DEBUG_OUTPUT("pointed date");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_DATE_FULL_POINTED;
}
-#line 12655 "<stdout>"
+#line 12659 "<stdout>"
yy898:
YYDEBUG(898, *YYCURSOR);
yych = *++YYCURSOR;
yy943:
YYDEBUG(943, *YYCURSOR);
-#line 1015 "resource/parse_date.re"
+#line 1017 "resource/parse_date.re"
{
DEBUG_OUTPUT("gnudateshort");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 13143 "<stdout>"
+#line 13147 "<stdout>"
yy944:
YYDEBUG(944, *YYCURSOR);
yych = *++YYCURSOR;
yy947:
YYDEBUG(947, *YYCURSOR);
-#line 988 "resource/parse_date.re"
+#line 990 "resource/parse_date.re"
{
DEBUG_OUTPUT("americanshort | american");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_AMERICAN;
}
-#line 13171 "<stdout>"
+#line 13175 "<stdout>"
yy948:
YYDEBUG(948, *YYCURSOR);
yyaccept = 12;
yy980:
YYDEBUG(980, *YYCURSOR);
-#line 1215 "resource/parse_date.re"
+#line 1217 "resource/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("clf");
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 13345 "<stdout>"
+#line 13349 "<stdout>"
yy981:
YYDEBUG(981, *YYCURSOR);
yyaccept = 13;
yy1020:
YYDEBUG(1020, *YYCURSOR);
-#line 1202 "resource/parse_date.re"
+#line 1204 "resource/parse_date.re"
{
DEBUG_OUTPUT("pgtextreverse");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_PG_TEXT;
}
-#line 13585 "<stdout>"
+#line 13589 "<stdout>"
yy1021:
YYDEBUG(1021, *YYCURSOR);
yych = *++YYCURSOR;
yy1032:
YYDEBUG(1032, *YYCURSOR);
-#line 1234 "resource/parse_date.re"
+#line 1236 "resource/parse_date.re"
{
DEBUG_OUTPUT("year4");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_CLF;
}
-#line 13701 "<stdout>"
+#line 13705 "<stdout>"
yy1033:
YYDEBUG(1033, *YYCURSOR);
yych = *++YYCURSOR;
yy1041:
YYDEBUG(1041, *YYCURSOR);
-#line 1067 "resource/parse_date.re"
+#line 1069 "resource/parse_date.re"
{
DEBUG_OUTPUT("datenodayrev");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_DATE_NO_DAY;
}
-#line 13828 "<stdout>"
+#line 13832 "<stdout>"
yy1042:
YYDEBUG(1042, *YYCURSOR);
yych = *++YYCURSOR;
yy1061:
YYDEBUG(1061, *YYCURSOR);
-#line 1170 "resource/parse_date.re"
+#line 1172 "resource/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweek");
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 14015 "<stdout>"
+#line 14019 "<stdout>"
yy1062:
YYDEBUG(1062, *YYCURSOR);
++YYCURSOR;
yy1063:
YYDEBUG(1063, *YYCURSOR);
-#line 1151 "resource/parse_date.re"
+#line 1153 "resource/parse_date.re"
{
timelib_sll w, d;
DEBUG_OUTPUT("isoweekday");
TIMELIB_DEINIT;
return TIMELIB_ISO_WEEK;
}
-#line 14037 "<stdout>"
+#line 14041 "<stdout>"
yy1064:
YYDEBUG(1064, *YYCURSOR);
yych = *++YYCURSOR;
yy1067:
YYDEBUG(1067, *YYCURSOR);
-#line 1138 "resource/parse_date.re"
+#line 1140 "resource/parse_date.re"
{
DEBUG_OUTPUT("pgydotd");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_PG_YEARDAY;
}
-#line 14110 "<stdout>"
+#line 14114 "<stdout>"
yy1068:
YYDEBUG(1068, *YYCURSOR);
yych = *++YYCURSOR;
yy1074:
YYDEBUG(1074, *YYCURSOR);
-#line 1104 "resource/parse_date.re"
+#line 1106 "resource/parse_date.re"
{
DEBUG_OUTPUT("datenocolon");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_DATE_NOCOLON;
}
-#line 14218 "<stdout>"
+#line 14222 "<stdout>"
yy1075:
YYDEBUG(1075, *YYCURSOR);
yych = *++YYCURSOR;
yy1085:
YYDEBUG(1085, *YYCURSOR);
-#line 1116 "resource/parse_date.re"
+#line 1118 "resource/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("xmlrpc | xmlrpcnocolon | soap | wddx");
TIMELIB_DEINIT;
return TIMELIB_XMLRPC_SOAP;
}
-#line 14315 "<stdout>"
+#line 14319 "<stdout>"
yy1086:
YYDEBUG(1086, *YYCURSOR);
yych = *++YYCURSOR;
yy1176:
YYDEBUG(1176, *YYCURSOR);
-#line 1003 "resource/parse_date.re"
+#line 1005 "resource/parse_date.re"
{
DEBUG_OUTPUT("iso8601date | iso8601dateslash | dateslash");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_ISO_DATE;
}
-#line 14747 "<stdout>"
+#line 14751 "<stdout>"
yy1177:
YYDEBUG(1177, *YYCURSOR);
yych = *++YYCURSOR;
yy1269:
YYDEBUG(1269, *YYCURSOR);
-#line 925 "resource/parse_date.re"
+#line 927 "resource/parse_date.re"
{
DEBUG_OUTPUT("gnunocolon");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_GNU_NOCOLON;
}
-#line 15394 "<stdout>"
+#line 15398 "<stdout>"
yy1270:
YYDEBUG(1270, *YYCURSOR);
yych = *++YYCURSOR;
yy1277:
YYDEBUG(1277, *YYCURSOR);
-#line 970 "resource/parse_date.re"
+#line 972 "resource/parse_date.re"
{
int tz_not_found;
DEBUG_OUTPUT("iso8601nocolon");
TIMELIB_DEINIT;
return TIMELIB_ISO_NOCOLON;
}
-#line 15492 "<stdout>"
+#line 15496 "<stdout>"
yy1278:
YYDEBUG(1278, *YYCURSOR);
yyaccept = 21;
yy1302:
YYDEBUG(1302, *YYCURSOR);
-#line 860 "resource/parse_date.re"
+#line 862 "resource/parse_date.re"
{
timelib_ull i;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 15756 "<stdout>"
+#line 15760 "<stdout>"
yy1303:
YYDEBUG(1303, *YYCURSOR);
yych = *++YYCURSOR;
yy1311:
YYDEBUG(1311, *YYCURSOR);
-#line 848 "resource/parse_date.re"
+#line 850 "resource/parse_date.re"
{
DEBUG_OUTPUT("tomorrow");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 15820 "<stdout>"
+#line 15824 "<stdout>"
yy1312:
YYDEBUG(1312, *YYCURSOR);
yych = *++YYCURSOR;
yy1314:
YYDEBUG(1314, *YYCURSOR);
-#line 838 "resource/parse_date.re"
+#line 840 "resource/parse_date.re"
{
DEBUG_OUTPUT("midnight | today");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 15836 "<stdout>"
+#line 15840 "<stdout>"
yy1315:
YYDEBUG(1315, *YYCURSOR);
yych = *++YYCURSOR;
yy1323:
YYDEBUG(1323, *YYCURSOR);
-#line 817 "resource/parse_date.re"
+#line 819 "resource/parse_date.re"
{
DEBUG_OUTPUT("now");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 15907 "<stdout>"
+#line 15911 "<stdout>"
yy1324:
YYDEBUG(1324, *YYCURSOR);
yych = *++YYCURSOR;
yy1326:
YYDEBUG(1326, *YYCURSOR);
-#line 826 "resource/parse_date.re"
+#line 828 "resource/parse_date.re"
{
DEBUG_OUTPUT("noon");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 15932 "<stdout>"
+#line 15936 "<stdout>"
yy1327:
YYDEBUG(1327, *YYCURSOR);
yych = *++YYCURSOR;
yy1335:
YYDEBUG(1335, *YYCURSOR);
-#line 805 "resource/parse_date.re"
+#line 807 "resource/parse_date.re"
{
DEBUG_OUTPUT("yesterday");
TIMELIB_INIT;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
}
-#line 15983 "<stdout>"
+#line 15987 "<stdout>"
}
}
-#line 1367 "resource/parse_date.re"
+#line 1371 "resource/parse_date.re"
}
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; }
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
#define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y = 0; }
-#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
+#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; s->time->relative.weekday_behavior = 0; }
#define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_weekday_relative = 1; }
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { return TIMELIB_ERROR; } else { s->time.have_zone = 1; } }
{ "twelfth", 0, 12 },
{ "last", 0, -1 },
{ "previous", 0, -1 },
- { "this", 0, 0 },
- { NULL, 0, 0 }
+ { "this", 1, 0 },
+ { NULL, 1, 0 }
};
/* The month table. */
return 0;
}
-static timelib_sll timelib_lookup_relative_text(char **ptr)
+static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
{
char *word;
char *begin = *ptr, *end;
for (tp = timelib_reltext_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
value = tp->value;
+ *behavior = tp->type;
}
}
return value;
}
-static timelib_sll timelib_get_relative_text(char **ptr)
+static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
{
while (**ptr == ' ' || **ptr == '-' || **ptr == '/') {
++*ptr;
}
- return timelib_lookup_relative_text(ptr);
+ return timelib_lookup_relative_text(ptr, behavior);
}
static long timelib_lookup_month(char **ptr)
return value;
}
-static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
+static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, Scanner *s)
{
const timelib_relunit* relunit;
TIMELIB_UNHAVE_TIME();
s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
s->time->relative.weekday = relunit->multiplier;
+ s->time->relative.weekday_behavior = behavior;
break;
}
}
relativetext
{
timelib_sll i;
+ int behavior;
DEBUG_OUTPUT("relativetext");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
while(*ptr) {
- i = timelib_get_relative_text((char **) &ptr);
+ i = timelib_get_relative_text((char **) &ptr, &behavior);
timelib_eat_spaces((char **) &ptr);
- timelib_set_relative((char **) &ptr, i, s);
+ timelib_set_relative((char **) &ptr, i, behavior, s);
}
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
relunit = timelib_lookup_relunit((char**) &ptr);
s->time->relative.weekday = relunit->multiplier;
+ s->time->relative.weekday_behavior = 1;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
while(*ptr) {
i = timelib_get_unsigned_nr((char **) &ptr, 24);
timelib_eat_spaces((char **) &ptr);
- timelib_set_relative((char **) &ptr, i, s);
+ timelib_set_relative((char **) &ptr, i, 0, s);
}
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
#define TIMELIB_UNHAVE_TIME() { s->time->have_time = 0; s->time->h = 0; s->time->i = 0; s->time->s = 0; s->time->f = 0; }
#define TIMELIB_HAVE_DATE() { if (s->time->have_date) { return TIMELIB_ERROR; } else { s->time->have_date = 1; } }
#define TIMELIB_UNHAVE_DATE() { s->time->have_date = 0; s->time->d = 0; s->time->m = 0; s->time->y = 0; }
-#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; }
+#define TIMELIB_HAVE_RELATIVE() { s->time->have_relative = 1; s->time->relative.weekday_behavior = 0; }
#define TIMELIB_HAVE_WEEKDAY_RELATIVE() { s->time->have_weekday_relative = 1; }
#define TIMELIB_HAVE_TZ() { s->cur = cursor; if (s->time->have_zone) { return TIMELIB_ERROR; } else { s->time.have_zone = 1; } }
{ "twelfth", 0, 12 },
{ "last", 0, -1 },
{ "previous", 0, -1 },
- { "this", 0, 0 },
- { NULL, 0, 0 }
+ { "this", 1, 0 },
+ { NULL, 1, 0 }
};
/* The month table. */
return 0;
}
-static timelib_sll timelib_lookup_relative_text(char **ptr)
+static timelib_sll timelib_lookup_relative_text(char **ptr, int *behavior)
{
char *word;
char *begin = *ptr, *end;
for (tp = timelib_reltext_lookup; tp->name; tp++) {
if (strcasecmp(word, tp->name) == 0) {
value = tp->value;
+ *behavior = tp->type;
}
}
return value;
}
-static timelib_sll timelib_get_relative_text(char **ptr)
+static timelib_sll timelib_get_relative_text(char **ptr, int *behavior)
{
while (**ptr == ' ' || **ptr == '-' || **ptr == '/') {
++*ptr;
}
- return timelib_lookup_relative_text(ptr);
+ return timelib_lookup_relative_text(ptr, behavior);
}
static long timelib_lookup_month(char **ptr)
return value;
}
-static void timelib_set_relative(char **ptr, timelib_sll amount, Scanner *s)
+static void timelib_set_relative(char **ptr, timelib_sll amount, int behavior, Scanner *s)
{
const timelib_relunit* relunit;
TIMELIB_UNHAVE_TIME();
s->time->relative.d += (amount > 0 ? amount - 1 : amount) * 7;
s->time->relative.weekday = relunit->multiplier;
+ s->time->relative.weekday_behavior = behavior;
break;
}
}
relativetext
{
timelib_sll i;
+ int behavior;
DEBUG_OUTPUT("relativetext");
TIMELIB_INIT;
TIMELIB_HAVE_RELATIVE();
while(*ptr) {
- i = timelib_get_relative_text((char **) &ptr);
+ i = timelib_get_relative_text((char **) &ptr, &behavior);
timelib_eat_spaces((char **) &ptr);
- timelib_set_relative((char **) &ptr, i, s);
+ timelib_set_relative((char **) &ptr, i, behavior, s);
}
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
relunit = timelib_lookup_relunit((char**) &ptr);
s->time->relative.weekday = relunit->multiplier;
+ s->time->relative.weekday_behavior = 1;
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
while(*ptr) {
i = timelib_get_unsigned_nr((char **) &ptr, 24);
timelib_eat_spaces((char **) &ptr);
- timelib_set_relative((char **) &ptr, i, s);
+ timelib_set_relative((char **) &ptr, i, 0, s);
}
TIMELIB_DEINIT;
return TIMELIB_RELATIVE;
d->relative.y, d->relative.m, d->relative.d, d->relative.h, d->relative.i, d->relative.s);
}
if (d->have_weekday_relative) {
- printf(" / %d", d->relative.weekday);
+ printf(" / %d.%d", d->relative.weekday, d->relative.weekday_behavior);
}
}
printf("\n");
timelib_sll h, i, s; /* Hours, mInutes and Seconds */
int weekday; /* Stores the day in 'next monday' */
+ int weekday_behavior; /* 0: the current day should *not* be counted when advancing forwards; 1: the current day *should* be counted */
} timelib_rel_time;
typedef struct timelib_time_offset {
current_dow = timelib_day_of_week(time->y, time->m, time->d);
difference = time->relative.weekday - current_dow;
- if ((time->relative.d < 0 && difference < 0) || (time->relative.d >= 0 && difference <= 0)) {
+ if ((time->relative.d < 0 && difference < 0) || (time->relative.d >= 0 && difference <= -time->relative.weekday_behavior)) {
difference += 7;
}
if (time->relative.weekday >= 0) {
$timestamp = call_user_func_array('mktime', $test);
print "ts = ". date("l Y-m-d H:i:s T", $timestamp). "\n";
- $strtotime_tstamp = strtotime("Monday", $timestamp);
+ $strtotime_tstamp = strtotime("first monday", $timestamp);
print "result = ".date("l Y-m-d H:i:s T", $strtotime_tstamp)."\n";
print "wanted = Monday 00:00:00\n\n";
}
putenv("TZ=America/Mendoza");
$tStamp = mktime (17, 17, 17, 1, 8327, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Sunday", $tStamp);
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday 00:00:00\n\n";
putenv("TZ=America/Catamarca");
$tStamp = mktime (17, 17, 17, 1, 7599, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Sunday", $tStamp);
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday 00:00:00\n\n";
putenv("TZ=America/Cordoba");
$tStamp = mktime (17, 17, 17, 1, 7599, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Sunday", $tStamp);
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday 00:00:00\n\n";
putenv("TZ=America/Rosario");
$tStamp = mktime (17, 17, 17, 1, 7958, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Tuesday", $tStamp);
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:00:00\n\n";
putenv("TZ=Europe/Vienna");
$tStamp = mktime (17, 17, 17, 1, 3746, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:00:00\n\n";
putenv("TZ=Asia/Baku");
$tStamp = mktime (17, 17, 17, 1, 8299, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Sunday", $tStamp);
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday 00:00:00\n\n";
putenv("TZ=America/Noronha");
$tStamp = mktime (17, 17, 17, 1, 10866, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Friday", $tStamp);
+$strtotime_tstamp = strtotime("next Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday 00:00:00\n\n";
putenv("TZ=America/Havana");
$tStamp = mktime (17, 17, 17, 1, 12720, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:00:00\n\n";
putenv("TZ=Europe/Tallinn");
$tStamp = mktime (17, 17, 17, 1, 11777, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Saturday", $tStamp);
+$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Saturday 00:00:00\n\n";
putenv("TZ=Asia/Jerusalem");
$tStamp = mktime (17, 17, 17, 1, 13056, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:00:00\n\n";
putenv("TZ=Europe/Vilnius");
$tStamp = mktime (17, 17, 17, 1, 12140, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Friday", $tStamp);
+$strtotime_tstamp = strtotime("next Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday 00:00:00\n\n";
putenv("TZ=Pacific/Kwajalein");
$tStamp = mktime (17, 17, 17, 1, 8626, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Friday", $tStamp);
+$strtotime_tstamp = strtotime("next Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday 00:00:00\n\n";
putenv("TZ=Asia/Ulan_Bator");
$tStamp = mktime (17, 17, 17, 1, 11588, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Saturday", $tStamp);
+$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Saturday 00:00:00\n\n";
putenv("TZ=America/Cancun");
$tStamp = mktime (17, 17, 17, 1, 11785, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Sunday", $tStamp);
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday 00:00:00\n\n";
putenv("TZ=America/Mexico_City");
$tStamp = mktime (17, 17, 17, 1, 11781, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Wednesday", $tStamp);
+$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Wednesday 00:00:00\n\n";
putenv("TZ=America/Mazatlan");
$tStamp = mktime (17, 17, 17, 1, 11780, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Tuesday", $tStamp);
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:00:00\n\n";
putenv("TZ=America/Chihuahua");
$tStamp = mktime (17, 17, 17, 1, 11782, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:00:00\n\n";
putenv("TZ=Asia/Kuala_Lumpur");
$tStamp = mktime (17, 17, 17, 1, 4380, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Monday", $tStamp);
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Pacific/Chatham");
$tStamp = mktime (17, 17, 17, 1, 1762, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Monday", $tStamp);
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=America/Lima");
$tStamp = mktime (17, 17, 17, 1, 5839, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:00:00\n\n";
putenv("TZ=Asia/Karachi");
$tStamp = mktime (17, 17, 17, 1, 11783, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Friday", $tStamp);
+$strtotime_tstamp = strtotime("next Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday 00:00:00\n\n";
putenv("TZ=America/Asuncion");
$tStamp = mktime (17, 17, 17, 1, 11746, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Wednesday", $tStamp);
+$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Wednesday 00:00:00\n\n";
putenv("TZ=Asia/Singapore");
$tStamp = mktime (17, 17, 17, 1, 4383, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:00:00\n\n";
putenv("TZ=America/Montevideo");
$tStamp = mktime (17, 17, 17, 1, 12678, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:00:00\n\n";
putenv("TZ=Pacific/Rarotonga");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Tuesday", $tStamp);
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:00:00\n\n";
putenv("TZ=Atlantic/South_Georgia");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Tuesday", $tStamp);
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:00:00\n\n";
putenv("TZ=America/Port-au-Prince");
$tStamp = mktime (17, 17, 17, 1, 12871, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Monday", $tStamp);
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Pacific/Enderbury");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Monday", $tStamp);
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Pacific/Kiritimati");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Monday", $tStamp);
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=America/Managua");
$tStamp = mktime (17, 17, 17, 1, 12879, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Tuesday", $tStamp);
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:00:00\n\n";
putenv("TZ=Pacific/Pitcairn");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Wednesday", $tStamp);
+$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Wednesday 00:00:00\n\n";
putenv("TZ=Pacific/Fakaofo");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Saturday", $tStamp);
+$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Saturday 00:00:00\n\n";
putenv("TZ=Pacific/Johnston");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Friday", $tStamp);
+$strtotime_tstamp = strtotime("next Friday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Friday 00:00:00\n\n";
?>
putenv("TZ=America/Jujuy");
$tStamp = mktime (17, 17, 17, 1, 7593, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Monday", $tStamp);
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Asia/Tbilisi");
$tStamp = mktime (17, 17, 17, 1, 12863, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Sunday", $tStamp);
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday 00:00:00\n\n";
?>
putenv("TZ=Africa/Bujumbura");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Wednesday", $tStamp);
+$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Wednesday 00:00:00\n\n";
putenv("TZ=Asia/Thimbu");
$tStamp = mktime (17, 17, 17, 1, 6476, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:30:00\n\n";
putenv("TZ=Indian/Cocos");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:00:00\n\n";
putenv("TZ=Africa/Lubumbashi");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Saturday", $tStamp);
+$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Saturday 00:00:00\n\n";
putenv("TZ=Asia/Kashgar");
$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 03:00:00\n\n";
putenv("TZ=Indian/Christmas");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Sunday", $tStamp);
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday 00:00:00\n\n";
putenv("TZ=America/Santo_Domingo");
$tStamp = mktime (17, 17, 17, 1, 291, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Sunday", $tStamp);
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday 00:30:00\n\n";
putenv("TZ=Pacific/Truk");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Tuesday", $tStamp);
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:00:00\n\n";
putenv("TZ=Pacific/Ponape");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Monday", $tStamp);
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=America/Scoresbysund");
$tStamp = mktime (17, 17, 17, 1, 4099, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Sunday", $tStamp);
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday 02:00:00\n\n";
putenv("TZ=America/Guyana");
$tStamp = mktime (17, 17, 17, 1, 2031, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:45:00\n\n";
putenv("TZ=Asia/Tehran");
$tStamp = mktime (17, 17, 17, 1, 2855, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Tuesday", $tStamp);
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:30:00\n\n";
putenv("TZ=Pacific/Tarawa");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Monday", $tStamp);
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday 00:00:00\n\n";
putenv("TZ=Africa/Monrovia");
$tStamp = mktime (17, 17, 17, 1, 845, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Monday", $tStamp);
+$strtotime_tstamp = strtotime("next Monday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Monday 00:44:30\n\n";
putenv("TZ=Asia/Katmandu");
$tStamp = mktime (17, 17, 17, 1, 5838, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Wednesday", $tStamp);
+$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Wednesday 00:15:00\n\n";
putenv("TZ=Pacific/Nauru");
$tStamp = mktime (17, 17, 17, 1, 3401, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Tuesday", $tStamp);
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:30:00\n\n";
putenv("TZ=Pacific/Niue");
$tStamp = mktime (17, 17, 17, 1, 3189, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Sunday", $tStamp);
+$strtotime_tstamp = strtotime("next Sunday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Sunday 00:30:00\n\n";
putenv("TZ=Pacific/Port_Moresby");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 00:00:00\n\n";
putenv("TZ=America/Miquelon");
$tStamp = mktime (17, 17, 17, 1, 3767, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Thursday", $tStamp);
+$strtotime_tstamp = strtotime("next Thursday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Thursday 01:00:00\n\n";
putenv("TZ=Pacific/Palau");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Saturday", $tStamp);
+$strtotime_tstamp = strtotime("next Saturday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Saturday 00:00:00\n\n";
putenv("TZ=Pacific/Funafuti");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Wednesday", $tStamp);
+$strtotime_tstamp = strtotime("next Wednesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Wednesday 00:00:00\n\n";
putenv("TZ=Pacific/Wake");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Tuesday", $tStamp);
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:00:00\n\n";
putenv("TZ=Pacific/Wallis");
$tStamp = mktime (17, 17, 17, 1, 1, 1970);
print "tStamp=". date("l Y-m-d H:i:s T I", $tStamp). "\n";
-$strtotime_tstamp = strtotime("Tuesday", $tStamp);
+$strtotime_tstamp = strtotime("next Tuesday", $tStamp);
print "result=".date("l Y-m-d H:i:s T I", $strtotime_tstamp)."\n";
print "wanted=Tuesday 00:00:00\n\n";