mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-31 09:21:18 +02:00
- neutrino: fix timers from deepstandby; RTC was missing
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -4317,18 +4317,23 @@ void CNeutrinoApp::ExitRun(int exit_code)
|
||||
#endif
|
||||
if (exit_code != CNeutrinoApp::EXIT_REBOOT)
|
||||
{
|
||||
FILE *f;
|
||||
|
||||
if (timer_minutes)
|
||||
{
|
||||
time_t t = timer_minutes * 60;
|
||||
struct tm *tm = localtime(&t);
|
||||
char date[30];
|
||||
strftime(date, sizeof(date), "%c", tm);
|
||||
printf("wakeup_time: %s (%ld)\n", date, timer_minutes * 60);
|
||||
|
||||
/* prioritize proc filesystem */
|
||||
|
||||
time_t t = timer_minutes * 60;
|
||||
struct tm *lt = localtime(&t);
|
||||
char date[30];
|
||||
strftime(date, sizeof(date), "%c", lt);
|
||||
printf("wakeup time : %s (%ld)\n", date, timer_minutes * 60);
|
||||
|
||||
// FIXME: use proc_put()
|
||||
|
||||
if (access("/proc/stb/fp/wakeup_time", F_OK) == 0)
|
||||
{
|
||||
FILE *f = fopen("/proc/stb/fp/wakeup_time","w");
|
||||
f = fopen("/proc/stb/fp/wakeup_time","w");
|
||||
if (f)
|
||||
{
|
||||
fprintf(f, "%ld\n", timer_minutes * 60);
|
||||
@@ -4337,10 +4342,43 @@ void CNeutrinoApp::ExitRun(int exit_code)
|
||||
else
|
||||
perror("fopen /proc/stb/fp/wakeup_time");
|
||||
}
|
||||
|
||||
t = time(NULL);
|
||||
lt = localtime(&t);
|
||||
strftime(date, sizeof(date), "%c", lt);
|
||||
printf("current time: %s (%ld)\n", date, t);
|
||||
|
||||
if (access("/proc/stb/fp/rtc", F_OK) == 0)
|
||||
{
|
||||
f = fopen("/proc/stb/fp/rtc","w");
|
||||
if (f)
|
||||
{
|
||||
fprintf(f, "%ld\n", t);
|
||||
fclose(f);
|
||||
}
|
||||
else
|
||||
perror("fopen /proc/stb/fp/rtc");
|
||||
}
|
||||
|
||||
struct tm *gt = gmtime(&t);
|
||||
int offset = (lt->tm_hour - gt->tm_hour) * 3600;
|
||||
printf("rtc_offset : %d\n", offset);
|
||||
|
||||
if (access("/proc/stb/fp/rtc_offset", F_OK) == 0)
|
||||
{
|
||||
f = fopen("/proc/stb/fp/rtc_offset","w");
|
||||
if (f)
|
||||
{
|
||||
fprintf(f, "%d\n", offset);
|
||||
fclose(f);
|
||||
}
|
||||
else
|
||||
perror("fopen /proc/stb/fp/rtc_offset");
|
||||
}
|
||||
}
|
||||
|
||||
/* not platform specific */
|
||||
FILE *f = fopen("/tmp/.timer", "w");
|
||||
f = fopen("/tmp/.timer", "w");
|
||||
if (f)
|
||||
{
|
||||
fprintf(f, "%ld\n", timer_minutes ? timer_minutes * 60 : 0);
|
||||
|
Reference in New Issue
Block a user