summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/args.c4
-rw-r--r--src/ui-calendar.c8
-rw-r--r--src/utils.c6
-rw-r--r--test/data/apts-y2k38-0014
-rwxr-xr-xtest/y2k38-001.sh27
5 files changed, 36 insertions, 13 deletions
diff --git a/src/args.c b/src/args.c
index e6ba6e0..f0015d0 100644
--- a/src/args.c
+++ b/src/args.c
@@ -310,7 +310,7 @@ date_arg_from_to(long from, long to, int add_line, const char *fmt_apt,
}
}
-static int parse_datearg(const char *str)
+static long parse_datearg(const char *str)
{
struct date day;
@@ -329,7 +329,7 @@ static int parse_datearg(const char *str)
return -1;
}
-static int parse_datetimearg(const char *str)
+static long parse_datetimearg(const char *str)
{
char *date = mem_strdup(str);
char *time;
diff --git a/src/ui-calendar.c b/src/ui-calendar.c
index d72f71a..4216903 100644
--- a/src/ui-calendar.c
+++ b/src/ui-calendar.c
@@ -630,9 +630,7 @@ void ui_calendar_change_day(int datefmt)
char *outstr;
int dday, dmonth, dyear;
int wrong_day = 1;
- const char *mesg_line1 =
- _("The day you entered is not valid "
- "(should be between 01/01/1902 and 12/31/2037)");
+ const char *mesg_line1 = _("The day you entered is not valid");
const char *mesg_line2 = _("Press [ENTER] to continue");
const char *request_date =
_("Enter the day to go to [ENTER for today] : %s");
@@ -739,10 +737,6 @@ void ui_calendar_move(enum move move, int count)
t.tm_mday = 1;
t.tm_mon = 0;
t.tm_year = 2;
- } else if (t.tm_year > 137) {
- t.tm_mday = 31;
- t.tm_mon = 11;
- t.tm_year = 137;
}
slctd_day.dd = t.tm_mday;
diff --git a/src/utils.c b/src/utils.c
index 527dec8..bfcae99 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -651,10 +651,8 @@ char *new_tempfile(const char *prefix)
*/
int check_date(unsigned year, unsigned month, unsigned day)
{
- return (year >= 1902 && year <= 2037 && month >= 1 && month <= 12
- && day >= 1 && day <= days[month - 1] + (month == 2
- && ISLEAP(year)) ?
- 1 : 0);
+ return (year >= 1902 && month >= 1 && month <= 12 && day >= 1 &&
+ day <= days[month - 1] + (month == 2 && ISLEAP(year)) ? 1 : 0);
}
/*
diff --git a/test/data/apts-y2k38-001 b/test/data/apts-y2k38-001
new file mode 100644
index 0000000..bf6d664
--- /dev/null
+++ b/test/data/apts-y2k38-001
@@ -0,0 +1,4 @@
+01/19/2038 [1] Event 1
+01/20/2038 [1] Event 2
+01/01/2100 [1] Event 3
+01/01/9999 [1] Event 4
diff --git a/test/y2k38-001.sh b/test/y2k38-001.sh
new file mode 100755
index 0000000..5243ea6
--- /dev/null
+++ b/test/y2k38-001.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+. "${TEST_INIT:-./test-init.sh}"
+
+if [ "$1" = 'actual' ]; then
+ "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-y2k38-001" \
+ -d01/19/2038
+ "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-y2k38-001" \
+ -d01/20/2038
+ "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-y2k38-001" \
+ -d01/01/2100
+ "$CALCURSE" --read-only -D "$DATA_DIR"/ -c "$DATA_DIR/apts-y2k38-001" \
+ -d01/01/9999
+elif [ "$1" = 'expected' ]; then
+ cat <<EOD
+01/19/38:
+ * Event 1
+01/20/38:
+ * Event 2
+01/01/00:
+ * Event 3
+01/01/99:
+ * Event 4
+EOD
+else
+ ./run-test "$0"
+fi