summaryrefslogtreecommitdiff
path: root/firmware/target/hosted
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2018-04-10 13:26:56 +0200
committerMarcin Bukat <marcin.bukat@gmail.com>2018-06-12 10:31:15 +0200
commitfbaa97496f9717d7cf45456c47ce3e271da29e28 (patch)
tree77efdc05962018111ead6edca70e49c0cf8a5797 /firmware/target/hosted
parent937589ca3a0a9aad62f7f181c9256244a6d2f418 (diff)
downloadrockbox-fbaa97496f9717d7cf45456c47ce3e271da29e28.tar.gz
rockbox-fbaa97496f9717d7cf45456c47ce3e271da29e28.zip
Agptek Rocker: Implement RTC support
Add define in config file to enable RTC support in rockbox, Fix time_menu.c to include radio.h only when tuner is present Implement time setting function on linux (was empty stub) Not tested. Change-Id: I40e6c4a6c1b66ada9cf4e698e502e221d0fc44df
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r--firmware/target/hosted/rtc.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/firmware/target/hosted/rtc.c b/firmware/target/hosted/rtc.c
index 8c430f3774..cb11d3ca3c 100644
--- a/firmware/target/hosted/rtc.c
+++ b/firmware/target/hosted/rtc.c
@@ -9,6 +9,7 @@
9 * 9 *
10 * Based upon code (C) 2002 by Björn Stenberg 10 * Based upon code (C) 2002 by Björn Stenberg
11 * Copyright (C) 2011 by Thomas Jarosch 11 * Copyright (C) 2011 by Thomas Jarosch
12 * Copyright (C) 2018 by Marcin Bukat
12 * 13 *
13 * This program is free software; you can redistribute it and/or 14 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License 15 * modify it under the terms of the GNU General Public License
@@ -20,6 +21,7 @@
20 * 21 *
21 ****************************************************************************/ 22 ****************************************************************************/
22#include <time.h> 23#include <time.h>
24#include <sys/time.h>
23 25
24void rtc_init(void) 26void rtc_init(void)
25{ 27{
@@ -35,6 +37,10 @@ int rtc_read_datetime(struct tm *tm)
35 37
36int rtc_write_datetime(const struct tm *tm) 38int rtc_write_datetime(const struct tm *tm)
37{ 39{
38 (void)tm; 40 struct timeval tv;
39 return -1; 41
42 tv.tv_sec = mktime((struct tm *)tm);
43 tv.tv_usec = 0;
44
45 return settimeofday(&tv, NULL);
40} 46}