summaryrefslogtreecommitdiff
path: root/src/drivers/elog
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/elog')
-rw-r--r--src/drivers/elog/elog.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index de18d5d82f..d7751c2012 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -649,6 +649,7 @@ int elog_init(void)
*/
static void elog_fill_timestamp(struct event_header *event)
{
+#if IS_ENABLED(CONFIG_RTC)
struct rtc_time time;
rtc_get(&time);
@@ -659,9 +660,12 @@ static void elog_fill_timestamp(struct event_header *event)
event->month = bin2bcd(time.mon);
event->year = bin2bcd(time.year) & 0xff;
+
/* Basic sanity check of expected ranges */
if (event->month > 0x12 || event->day > 0x31 || event->hour > 0x23 ||
- event->minute > 0x59 || event->second > 0x59) {
+ event->minute > 0x59 || event->second > 0x59)
+#endif
+ {
event->year = 0;
event->month = 0;
event->day = 0;