summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2020-04-27 22:15:50 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2020-04-27 22:15:50 +0200
commit6658478210e491eda76a0141963f56eedcab4855 (patch)
treec4294286bda33bb173e8d43c0c5f664e9a2fb9fe
parentd2941c97439c0ecba5280f5e05299810dbc3a4da (diff)
downloadrtc-tools-6658478210e491eda76a0141963f56eedcab4855.tar.gz
rtc-range: check for more dates
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r--rtc-range.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/rtc-range.c b/rtc-range.c
index a26c7fe..323b271 100644
--- a/rtc-range.c
+++ b/rtc-range.c
@@ -36,12 +36,24 @@ static struct {
struct rtc_time tm;
struct rtc_time expected;
} dates [] = {
+ { /* UNIX epoch */
+ .tm = { .tm_year = 70, .tm_mon = 0, .tm_mday = 1,
+ .tm_hour = 0, .tm_min = 0, .tm_sec = 0 },
+ .expected = { .tm_year = 70, .tm_mon = 0, .tm_mday = 1,
+ .tm_hour = 0, .tm_min = 0, .tm_sec = 1 }
+ },
{ /* 2000 is a leap year */
.tm = { .tm_year = 100, .tm_mon = 1, .tm_mday = 28,
.tm_hour = 23, .tm_min = 59, .tm_sec = 59 },
.expected = { .tm_year = 100, .tm_mon = 1, .tm_mday = 29,
.tm_hour = 0, .tm_min = 0, .tm_sec = 0 }
},
+ { /* 2020 is a leap year */
+ .tm = { .tm_year = 120, .tm_mon = 1, .tm_mday = 28,
+ .tm_hour = 23, .tm_min = 59, .tm_sec = 59 },
+ .expected = { .tm_year = 120, .tm_mon = 1, .tm_mday = 29,
+ .tm_hour = 0, .tm_min = 0, .tm_sec = 0 }
+ },
{ /* signed 32bit time_t overflow */
.tm = { .tm_year = 138, .tm_mday = 19,
.tm_hour = 3, .tm_min = 14, .tm_sec = 7 },