diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/timefuncs.c | 3 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_d2.c | 5 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_ds1339_ds3231.c | 5 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_e8564.c | 6 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_m41st84w.c | 8 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_mr100.c | 5 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_pcf50605.c | 6 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_pcf50606.c | 5 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_rx5x348ab.c | 5 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_s35380a.c | 5 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_s35390a.c | 5 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_s3c2440.c | 5 | ||||
-rw-r--r-- | firmware/libc/gmtime.c | 3 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c | 5 | ||||
-rw-r--r-- | firmware/target/arm/s5l8702/ipod6g/rtc-ipod6g.c | 5 |
15 files changed, 54 insertions, 22 deletions
diff --git a/firmware/common/timefuncs.c b/firmware/common/timefuncs.c index ffa6e2a0b3..c8819ea76e 100644 --- a/firmware/common/timefuncs.c +++ b/firmware/common/timefuncs.c | |||
@@ -71,9 +71,6 @@ struct tm *get_time(void) | |||
71 | /* Once per second, 1/10th of a second off */ | 71 | /* Once per second, 1/10th of a second off */ |
72 | timeout = HZ * (current_tick / HZ + 1) + HZ / 5; | 72 | timeout = HZ * (current_tick / HZ + 1) + HZ / 5; |
73 | rtc_read_datetime(&tm); | 73 | rtc_read_datetime(&tm); |
74 | set_day_of_week(&tm); | ||
75 | |||
76 | tm.tm_yday = 0; /* Not implemented for now */ | ||
77 | tm.tm_isdst = -1; /* Not implemented for now */ | 74 | tm.tm_isdst = -1; /* Not implemented for now */ |
78 | } | 75 | } |
79 | #else /* No RTC */ | 76 | #else /* No RTC */ |
diff --git a/firmware/drivers/rtc/rtc_d2.c b/firmware/drivers/rtc/rtc_d2.c index a2a40fe7ac..1d202410e2 100644 --- a/firmware/drivers/rtc/rtc_d2.c +++ b/firmware/drivers/rtc/rtc_d2.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "pcf50606.h" | 23 | #include "pcf50606.h" |
24 | #include "pcf50635.h" | 24 | #include "pcf50635.h" |
25 | #include "pmu-target.h" | 25 | #include "pmu-target.h" |
26 | #include "timefuncs.h" | ||
26 | 27 | ||
27 | void rtc_init(void) | 28 | void rtc_init(void) |
28 | { | 29 | { |
@@ -49,10 +50,12 @@ int rtc_read_datetime(struct tm *tm) | |||
49 | tm->tm_sec = buf[0]; | 50 | tm->tm_sec = buf[0]; |
50 | tm->tm_min = buf[1]; | 51 | tm->tm_min = buf[1]; |
51 | tm->tm_hour = buf[2]; | 52 | tm->tm_hour = buf[2]; |
52 | tm->tm_wday = buf[3]; | ||
53 | tm->tm_mday = buf[4]; | 53 | tm->tm_mday = buf[4]; |
54 | tm->tm_mon = buf[5] - 1; | 54 | tm->tm_mon = buf[5] - 1; |
55 | tm->tm_year = buf[6] + 100; | 55 | tm->tm_year = buf[6] + 100; |
56 | tm->tm_yday = 0; /* Not implemented for now */ | ||
57 | |||
58 | set_day_of_week(tm); | ||
56 | 59 | ||
57 | return rc; | 60 | return rc; |
58 | } | 61 | } |
diff --git a/firmware/drivers/rtc/rtc_ds1339_ds3231.c b/firmware/drivers/rtc/rtc_ds1339_ds3231.c index a813e8d999..8f2a531e5f 100644 --- a/firmware/drivers/rtc/rtc_ds1339_ds3231.c +++ b/firmware/drivers/rtc/rtc_ds1339_ds3231.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "rtc.h" | 21 | #include "rtc.h" |
22 | #include "logf.h" | 22 | #include "logf.h" |
23 | #include "sw_i2c.h" | 23 | #include "sw_i2c.h" |
24 | #include "timefuncs.h" | ||
24 | 25 | ||
25 | #define RTC_ADDR 0xD0 | 26 | #define RTC_ADDR 0xD0 |
26 | 27 | ||
@@ -122,10 +123,12 @@ int rtc_read_datetime(struct tm *tm) | |||
122 | tm->tm_sec = BCD2DEC(buf[0] & 0x7f); | 123 | tm->tm_sec = BCD2DEC(buf[0] & 0x7f); |
123 | tm->tm_min = BCD2DEC(buf[1] & 0x7f); | 124 | tm->tm_min = BCD2DEC(buf[1] & 0x7f); |
124 | tm->tm_hour = BCD2DEC(buf[2] & 0x3f); | 125 | tm->tm_hour = BCD2DEC(buf[2] & 0x3f); |
125 | tm->tm_wday = BCD2DEC(buf[3] & 0x7) - 1; /* timefuncs wants 0..6 for wday */ | ||
126 | tm->tm_mday = BCD2DEC(buf[4] & 0x3f); | 126 | tm->tm_mday = BCD2DEC(buf[4] & 0x3f); |
127 | tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1; | 127 | tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1; |
128 | tm->tm_year = BCD2DEC(buf[6]) + 100; | 128 | tm->tm_year = BCD2DEC(buf[6]) + 100; |
129 | tm->tm_yday = 0; /* Not implemented for now */ | ||
130 | |||
131 | set_day_of_week(tm); | ||
129 | 132 | ||
130 | return rc; | 133 | return rc; |
131 | } | 134 | } |
diff --git a/firmware/drivers/rtc/rtc_e8564.c b/firmware/drivers/rtc/rtc_e8564.c index 7a02ec6cdc..7837bbaa83 100644 --- a/firmware/drivers/rtc/rtc_e8564.c +++ b/firmware/drivers/rtc/rtc_e8564.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "kernel.h" | 25 | #include "kernel.h" |
26 | #include "system.h" | 26 | #include "system.h" |
27 | #include "i2c-pp.h" | 27 | #include "i2c-pp.h" |
28 | #include <stdbool.h> | 28 | #include "timefuncs.h" |
29 | 29 | ||
30 | /*RTC_E8564's slave address is 0x51*/ | 30 | /*RTC_E8564's slave address is 0x51*/ |
31 | #define RTC_ADDR 0x51 | 31 | #define RTC_ADDR 0x51 |
@@ -83,9 +83,11 @@ int rtc_read_datetime(struct tm *tm) | |||
83 | tm->tm_min = BCD2DEC(buf[1] & 0x7f); | 83 | tm->tm_min = BCD2DEC(buf[1] & 0x7f); |
84 | tm->tm_hour = BCD2DEC(buf[2] & 0x3f); | 84 | tm->tm_hour = BCD2DEC(buf[2] & 0x3f); |
85 | tm->tm_mday = BCD2DEC(buf[3] & 0x3f); | 85 | tm->tm_mday = BCD2DEC(buf[3] & 0x3f); |
86 | tm->tm_wday = BCD2DEC(buf[4] & 0x7); | ||
87 | tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1; | 86 | tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1; |
88 | tm->tm_year = BCD2DEC(buf[6]) + 100; | 87 | tm->tm_year = BCD2DEC(buf[6]) + 100; |
88 | tm->tm_yday = 0; /* Not implemented for now */ | ||
89 | |||
90 | set_day_of_week(tm); | ||
89 | 91 | ||
90 | return read; | 92 | return read; |
91 | } | 93 | } |
diff --git a/firmware/drivers/rtc/rtc_m41st84w.c b/firmware/drivers/rtc/rtc_m41st84w.c index 4cfa155bfb..621e650f68 100644 --- a/firmware/drivers/rtc/rtc_m41st84w.c +++ b/firmware/drivers/rtc/rtc_m41st84w.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "rtc.h" | 23 | #include "rtc.h" |
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include <stdbool.h> | 26 | #include "timefuncs.h" |
27 | 27 | ||
28 | #define RTC_ADR 0xd0 | 28 | #define RTC_ADR 0xd0 |
29 | #define RTC_DEV_WRITE (RTC_ADR | 0x00) | 29 | #define RTC_DEV_WRITE (RTC_ADR | 0x00) |
@@ -257,14 +257,12 @@ int rtc_read_datetime(struct tm *tm) | |||
257 | tm->tm_sec = BCD2DEC(buf[0] & 0x7f); | 257 | tm->tm_sec = BCD2DEC(buf[0] & 0x7f); |
258 | tm->tm_min = BCD2DEC(buf[1] & 0x7f); | 258 | tm->tm_min = BCD2DEC(buf[1] & 0x7f); |
259 | tm->tm_hour = BCD2DEC(buf[2] & 0x3f); | 259 | tm->tm_hour = BCD2DEC(buf[2] & 0x3f); |
260 | tm->tm_wday = BCD2DEC(buf[3] & 0x7); | ||
261 | tm->tm_mday = BCD2DEC(buf[4] & 0x3f); | 260 | tm->tm_mday = BCD2DEC(buf[4] & 0x3f); |
262 | tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1; | 261 | tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1; |
263 | tm->tm_year = BCD2DEC(buf[6]) + 100; | 262 | tm->tm_year = BCD2DEC(buf[6]) + 100; |
263 | tm->tm_yday = 0; /* Not implemented for now */ | ||
264 | 264 | ||
265 | /* Adjust weekday */ | 265 | set_day_of_week(tm); |
266 | if (tm->tm_wday == 7) | ||
267 | tm->tm_wday = 0; | ||
268 | 266 | ||
269 | return rc; | 267 | return rc; |
270 | } | 268 | } |
diff --git a/firmware/drivers/rtc/rtc_mr100.c b/firmware/drivers/rtc/rtc_mr100.c index 209845cea8..6e1b0b5f40 100644 --- a/firmware/drivers/rtc/rtc_mr100.c +++ b/firmware/drivers/rtc/rtc_mr100.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "logf.h" | 22 | #include "logf.h" |
23 | #include "sw_i2c.h" | 23 | #include "sw_i2c.h" |
24 | #include "i2c-pp.h" | 24 | #include "i2c-pp.h" |
25 | #include "timefuncs.h" | ||
25 | 26 | ||
26 | /* The RTC chip is unknown, the information about it was gathered by | 27 | /* The RTC chip is unknown, the information about it was gathered by |
27 | * reverse engineering the bootloader. | 28 | * reverse engineering the bootloader. |
@@ -140,10 +141,12 @@ int rtc_read_datetime(struct tm *tm) | |||
140 | tm->tm_sec = buf[6]; | 141 | tm->tm_sec = buf[6]; |
141 | tm->tm_min = buf[5]; | 142 | tm->tm_min = buf[5]; |
142 | tm->tm_hour = buf[4]; | 143 | tm->tm_hour = buf[4]; |
143 | tm->tm_wday = buf[3]; | ||
144 | tm->tm_mday = buf[2]; | 144 | tm->tm_mday = buf[2]; |
145 | tm->tm_mon = buf[1] - 1; | 145 | tm->tm_mon = buf[1] - 1; |
146 | tm->tm_year = buf[0] + 100; | 146 | tm->tm_year = buf[0] + 100; |
147 | tm->tm_yday = 0; /* Not implemented for now */ | ||
148 | |||
149 | set_day_of_week(tm); | ||
147 | 150 | ||
148 | return rc; | 151 | return rc; |
149 | } | 152 | } |
diff --git a/firmware/drivers/rtc/rtc_pcf50605.c b/firmware/drivers/rtc/rtc_pcf50605.c index 8c54a590c6..daa35fb13f 100644 --- a/firmware/drivers/rtc/rtc_pcf50605.c +++ b/firmware/drivers/rtc/rtc_pcf50605.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include "pcf50605.h" | 26 | #include "pcf50605.h" |
27 | #include <stdbool.h> | 27 | #include "timefuncs.h" |
28 | 28 | ||
29 | /* Values which each disable one alarm time register */ | 29 | /* Values which each disable one alarm time register */ |
30 | static const char alarm_disable[] = { | 30 | static const char alarm_disable[] = { |
@@ -49,10 +49,12 @@ int rtc_read_datetime(struct tm *tm) | |||
49 | tm->tm_sec = buf[0]; | 49 | tm->tm_sec = buf[0]; |
50 | tm->tm_min = buf[1]; | 50 | tm->tm_min = buf[1]; |
51 | tm->tm_hour = buf[2]; | 51 | tm->tm_hour = buf[2]; |
52 | tm->tm_wday = buf[3]; | ||
53 | tm->tm_mday = buf[4]; | 52 | tm->tm_mday = buf[4]; |
54 | tm->tm_mon = buf[5] - 1; | 53 | tm->tm_mon = buf[5] - 1; |
55 | tm->tm_year = buf[6] + 100; | 54 | tm->tm_year = buf[6] + 100; |
55 | tm->tm_yday = 0; /* Not implemented for now */ | ||
56 | |||
57 | set_day_of_week(tm); | ||
56 | 58 | ||
57 | return rc; | 59 | return rc; |
58 | } | 60 | } |
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 | ||
28 | void rtc_init(void) | 29 | void 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 | ||
diff --git a/firmware/drivers/rtc/rtc_rx5x348ab.c b/firmware/drivers/rtc/rtc_rx5x348ab.c index f31ab5623e..6d7b78b281 100644 --- a/firmware/drivers/rtc/rtc_rx5x348ab.c +++ b/firmware/drivers/rtc/rtc_rx5x348ab.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "spi.h" | 23 | #include "spi.h" |
24 | #include "rtc.h" | 24 | #include "rtc.h" |
25 | #include "timefuncs.h" | ||
25 | 26 | ||
26 | /* Choose one of: */ | 27 | /* Choose one of: */ |
27 | #define ADDR_READ 0x04 | 28 | #define ADDR_READ 0x04 |
@@ -48,10 +49,12 @@ int rtc_read_datetime(struct tm *tm) | |||
48 | tm->tm_sec = buf[0]; | 49 | tm->tm_sec = buf[0]; |
49 | tm->tm_min = buf[1]; | 50 | tm->tm_min = buf[1]; |
50 | tm->tm_hour = buf[2]; | 51 | tm->tm_hour = buf[2]; |
51 | tm->tm_wday = buf[3]; | ||
52 | tm->tm_mday = buf[4]; | 52 | tm->tm_mday = buf[4]; |
53 | tm->tm_mon = buf[5] - 1; | 53 | tm->tm_mon = buf[5] - 1; |
54 | tm->tm_year = buf[6] + 100; | 54 | tm->tm_year = buf[6] + 100; |
55 | tm->tm_yday = 0; /* Not implemented for now */ | ||
56 | |||
57 | set_day_of_week(tm); | ||
55 | 58 | ||
56 | return 1; | 59 | return 1; |
57 | } | 60 | } |
diff --git a/firmware/drivers/rtc/rtc_s35380a.c b/firmware/drivers/rtc/rtc_s35380a.c index a45924d725..f32c431990 100644 --- a/firmware/drivers/rtc/rtc_s35380a.c +++ b/firmware/drivers/rtc/rtc_s35380a.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "config.h" | 23 | #include "config.h" |
24 | #include "rtc.h" | 24 | #include "rtc.h" |
25 | #include "i2c-coldfire.h" | 25 | #include "i2c-coldfire.h" |
26 | #include "timefuncs.h" | ||
26 | 27 | ||
27 | /* Driver for the Seiko S35380A real-time clock chip with i2c interface | 28 | /* Driver for the Seiko S35380A real-time clock chip with i2c interface |
28 | 29 | ||
@@ -188,10 +189,12 @@ int rtc_read_datetime(struct tm *tm) | |||
188 | tm->tm_sec = buf[TIME_SECOND]; | 189 | tm->tm_sec = buf[TIME_SECOND]; |
189 | tm->tm_min = buf[TIME_MINUTE]; | 190 | tm->tm_min = buf[TIME_MINUTE]; |
190 | tm->tm_hour = buf[TIME_HOUR]; | 191 | tm->tm_hour = buf[TIME_HOUR]; |
191 | tm->tm_wday = buf[TIME_WEEKDAY]; | ||
192 | tm->tm_mday = buf[TIME_DAY]; | 192 | tm->tm_mday = buf[TIME_DAY]; |
193 | tm->tm_mon = buf[TIME_MONTH] - 1; | 193 | tm->tm_mon = buf[TIME_MONTH] - 1; |
194 | tm->tm_year = buf[TIME_YEAR] + 100; | 194 | tm->tm_year = buf[TIME_YEAR] + 100; |
195 | tm->tm_yday = 0; /* Not implemented for now */ | ||
196 | |||
197 | set_day_of_week(tm); | ||
195 | 198 | ||
196 | return ret; | 199 | return ret; |
197 | } | 200 | } |
diff --git a/firmware/drivers/rtc/rtc_s35390a.c b/firmware/drivers/rtc/rtc_s35390a.c index 13027d31a2..b82029a114 100644 --- a/firmware/drivers/rtc/rtc_s35390a.c +++ b/firmware/drivers/rtc/rtc_s35390a.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "rtc.h" | 23 | #include "rtc.h" |
24 | #include "i2c-s5l8700.h" | 24 | #include "i2c-s5l8700.h" |
25 | #include "timefuncs.h" | ||
25 | 26 | ||
26 | /* Driver for the Seiko S35390A real-time clock chip with i2c interface | 27 | /* Driver for the Seiko S35390A real-time clock chip with i2c interface |
27 | 28 | ||
@@ -75,10 +76,12 @@ int rtc_read_datetime(struct tm *tm) | |||
75 | tm->tm_sec = buf[6]; | 76 | tm->tm_sec = buf[6]; |
76 | tm->tm_min = buf[5]; | 77 | tm->tm_min = buf[5]; |
77 | tm->tm_hour = buf[4]; | 78 | tm->tm_hour = buf[4]; |
78 | tm->tm_wday = buf[3]; | ||
79 | tm->tm_mday = buf[2]; | 79 | tm->tm_mday = buf[2]; |
80 | tm->tm_mon = buf[1] - 1; | 80 | tm->tm_mon = buf[1] - 1; |
81 | tm->tm_year = buf[0] + 100; | 81 | tm->tm_year = buf[0] + 100; |
82 | tm->tm_yday = 0; /* Not implemented for now */ | ||
83 | |||
84 | set_day_of_week(tm); | ||
82 | 85 | ||
83 | return ret; | 86 | return ret; |
84 | } | 87 | } |
diff --git a/firmware/drivers/rtc/rtc_s3c2440.c b/firmware/drivers/rtc/rtc_s3c2440.c index a8787e3f8f..6cd34f0e23 100644 --- a/firmware/drivers/rtc/rtc_s3c2440.c +++ b/firmware/drivers/rtc/rtc_s3c2440.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "rtc.h" | 23 | #include "rtc.h" |
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include "timefuncs.h" | ||
26 | 27 | ||
27 | void rtc_init(void) | 28 | void rtc_init(void) |
28 | { | 29 | { |
@@ -35,10 +36,12 @@ int rtc_read_datetime(struct tm *tm) | |||
35 | tm->tm_sec = BCD2DEC(BCDSEC); | 36 | tm->tm_sec = BCD2DEC(BCDSEC); |
36 | tm->tm_min = BCD2DEC(BCDMIN); | 37 | tm->tm_min = BCD2DEC(BCDMIN); |
37 | tm->tm_hour = BCD2DEC(BCDHOUR); | 38 | tm->tm_hour = BCD2DEC(BCDHOUR); |
38 | tm->tm_wday = BCD2DEC(BCDDAY) - 1; /* timefuncs wants 0..6 for wday */ | ||
39 | tm->tm_mday = BCD2DEC(BCDDATE); | 39 | tm->tm_mday = BCD2DEC(BCDDATE); |
40 | tm->tm_mon = BCD2DEC(BCDMON) - 1; | 40 | tm->tm_mon = BCD2DEC(BCDMON) - 1; |
41 | tm->tm_year = BCD2DEC(BCDYEAR) + 100; | 41 | tm->tm_year = BCD2DEC(BCDYEAR) + 100; |
42 | tm->tm_yday = 0; /* Not implemented for now */ | ||
43 | |||
44 | set_day_of_week(tm); | ||
42 | 45 | ||
43 | return 1; | 46 | return 1; |
44 | } | 47 | } |
diff --git a/firmware/libc/gmtime.c b/firmware/libc/gmtime.c index e7ebdf0d90..c5deb593cd 100644 --- a/firmware/libc/gmtime.c +++ b/firmware/libc/gmtime.c | |||
@@ -108,6 +108,9 @@ struct tm *gmtime_r(const time_t *timep, struct tm *tm) | |||
108 | /* Second */ | 108 | /* Second */ |
109 | tm->tm_sec = seconds; | 109 | tm->tm_sec = seconds; |
110 | 110 | ||
111 | tm->tm_yday = 0; /* Not implemented for now */ | ||
112 | tm->tm_isdst = -1; /* Not implemented for now */ | ||
113 | |||
111 | return tm; | 114 | return tm; |
112 | } | 115 | } |
113 | 116 | ||
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c index 39cecc5291..6f6b58ca35 100644 --- a/firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c +++ b/firmware/target/arm/s5l8700/ipodnano2g/rtc-nano2g.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "pmu-target.h" | 25 | #include "pmu-target.h" |
26 | #include "timefuncs.h" | ||
26 | 27 | ||
27 | void rtc_init(void) | 28 | void rtc_init(void) |
28 | { | 29 | { |
@@ -41,10 +42,12 @@ int rtc_read_datetime(struct tm *tm) | |||
41 | tm->tm_sec = buf[0]; | 42 | tm->tm_sec = buf[0]; |
42 | tm->tm_min = buf[1]; | 43 | tm->tm_min = buf[1]; |
43 | tm->tm_hour = buf[2]; | 44 | tm->tm_hour = buf[2]; |
44 | tm->tm_wday = buf[3]; | ||
45 | tm->tm_mday = buf[4]; | 45 | tm->tm_mday = buf[4]; |
46 | tm->tm_mon = buf[5] - 1; | 46 | tm->tm_mon = buf[5] - 1; |
47 | tm->tm_year = buf[6] + 100; | 47 | tm->tm_year = buf[6] + 100; |
48 | tm->tm_yday = 0; /* Not implemented for now */ | ||
49 | |||
50 | set_day_of_week(tm); | ||
48 | 51 | ||
49 | return 0; | 52 | return 0; |
50 | } | 53 | } |
diff --git a/firmware/target/arm/s5l8702/ipod6g/rtc-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/rtc-ipod6g.c index 76ef8ecb00..384cded758 100644 --- a/firmware/target/arm/s5l8702/ipod6g/rtc-ipod6g.c +++ b/firmware/target/arm/s5l8702/ipod6g/rtc-ipod6g.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "kernel.h" | 23 | #include "kernel.h" |
24 | #include "system.h" | 24 | #include "system.h" |
25 | #include "pmu-target.h" | 25 | #include "pmu-target.h" |
26 | #include "timefuncs.h" | ||
26 | 27 | ||
27 | void rtc_init(void) | 28 | void rtc_init(void) |
28 | { | 29 | { |
@@ -41,10 +42,12 @@ int rtc_read_datetime(struct tm *tm) | |||
41 | tm->tm_sec = buf[0]; | 42 | tm->tm_sec = buf[0]; |
42 | tm->tm_min = buf[1]; | 43 | tm->tm_min = buf[1]; |
43 | tm->tm_hour = buf[2]; | 44 | tm->tm_hour = buf[2]; |
44 | tm->tm_wday = buf[3]; | ||
45 | tm->tm_mday = buf[4]; | 45 | tm->tm_mday = buf[4]; |
46 | tm->tm_mon = buf[5] - 1; | 46 | tm->tm_mon = buf[5] - 1; |
47 | tm->tm_year = buf[6] + 100; | 47 | tm->tm_year = buf[6] + 100; |
48 | tm->tm_yday = 0; /* Not implemented for now */ | ||
49 | |||
50 | set_day_of_week(tm); | ||
48 | 51 | ||
49 | return 0; | 52 | return 0; |
50 | } | 53 | } |