summaryrefslogtreecommitdiff
path: root/firmware/drivers/rtc/rtc_pcf50606.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2017-01-25 19:32:15 -0500
committerMichael Sevakis <jethead71@rockbox.org>2017-01-26 23:07:49 -0500
commit58b849c451ac1281c14bfc535ab7f411a0b736e0 (patch)
tree035026a62581900f72fa0d90bd694a8a92372c00 /firmware/drivers/rtc/rtc_pcf50606.c
parent783c77531c35e62dd754c510c4f2beefe6df4a9d (diff)
downloadrockbox-58b849c451ac1281c14bfc535ab7f411a0b736e0.tar.gz
rockbox-58b849c451ac1281c14bfc535ab7f411a0b736e0.zip
Move intrinsic RTC implmentation differences to driver files
Some drivers set tm_wday just fine and do not need it coerced to be correct. Others set tm_yday, so don't overwrite what the driver sets; just zero it inside if it can't fill the field. Move calls to set_day_of_week() to the sorts of drivers that presumably required the hammer (FS#11814) in get_time() where the weekday isn't locked to the date. Change-Id: Idd0ded6bfc9d9f48fcc1a6074068164c42fcf24a
Diffstat (limited to 'firmware/drivers/rtc/rtc_pcf50606.c')
-rw-r--r--firmware/drivers/rtc/rtc_pcf50606.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/firmware/drivers/rtc/rtc_pcf50606.c b/firmware/drivers/rtc/rtc_pcf50606.c
index cb6697207b..2c751e5b01 100644
--- a/firmware/drivers/rtc/rtc_pcf50606.c
+++ b/firmware/drivers/rtc/rtc_pcf50606.c
@@ -24,6 +24,7 @@
24#include "kernel.h" 24#include "kernel.h"
25#include "system.h" 25#include "system.h"
26#include "pcf50606.h" 26#include "pcf50606.h"
27#include "timefuncs.h"
27 28
28void rtc_init(void) 29void rtc_init(void)
29{ 30{
@@ -47,9 +48,9 @@ int rtc_read_datetime(struct tm *tm)
47 tm->tm_sec = buf[0]; 48 tm->tm_sec = buf[0];
48 tm->tm_min = buf[1]; 49 tm->tm_min = buf[1];
49 tm->tm_hour = buf[2]; 50 tm->tm_hour = buf[2];
50 tm->tm_wday = buf[3];
51 tm->tm_mday = buf[4]; 51 tm->tm_mday = buf[4];
52 tm->tm_mon = buf[5] - 1; 52 tm->tm_mon = buf[5] - 1;
53 tm->tm_yday = 0; /* Not implemented for now */
53#ifdef IRIVER_H300_SERIES 54#ifdef IRIVER_H300_SERIES
54 /* Special kludge to coexist with the iriver firmware. The iriver firmware 55 /* Special kludge to coexist with the iriver firmware. The iriver firmware
55 stores the date as 1965+nn, and allows a range of 1980..2064. We use 56 stores the date as 1965+nn, and allows a range of 1980..2064. We use
@@ -60,6 +61,8 @@ int rtc_read_datetime(struct tm *tm)
60 tm->tm_year = buf[6] + 100; 61 tm->tm_year = buf[6] + 100;
61#endif /* IRIVER_H300_SERIES */ 62#endif /* IRIVER_H300_SERIES */
62 63
64 set_day_of_week(tm);
65
63 return rc; 66 return rc;
64} 67}
65 68