Skip to content

Commit d42615d

Browse files
committed
Epoch timestamps are clamped to year 2000 or greater.
1 parent 50e7e84 commit d42615d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/RTCZero.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,12 @@ uint32_t RTCZero::getY2kEpoch()
408408

409409
void RTCZero::setEpoch(uint32_t ts)
410410
{
411-
setY2kEpoch(ts - EPOCH_TIME_OFF);
411+
if (ts < EPOCH_TIME_OFF) {
412+
setY2kEpoch(0);
413+
}
414+
else {
415+
setY2kEpoch(ts - EPOCH_TIME_OFF);
416+
}
412417
}
413418

414419
void RTCZero::setY2kEpoch(uint32_t ts)

0 commit comments

Comments
 (0)