summaryrefslogtreecommitdiff
authorsandman <sandman>2002-06-19 13:22:17 (UTC)
committer sandman <sandman>2002-06-19 13:22:17 (UTC)
commit952cb1ec42e827f1bc45f9d3f0a1b685ff545790 (patch) (side-by-side diff)
tree37c435e2b8e4de6c3c7dcf62b3fe33c8d2c97bc4
parent8d6e1b42d3b5b8dc376f0979d9f4363d9a6c6970 (diff)
downloadopie-952cb1ec42e827f1bc45f9d3f0a1b685ff545790.zip
opie-952cb1ec42e827f1bc45f9d3f0a1b685ff545790.tar.gz
opie-952cb1ec42e827f1bc45f9d3f0a1b685ff545790.tar.bz2
Added some debug capabilities via /tmp/opiealarm.log
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/opiealarm/opiealarm.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/opiealarm/opiealarm.c b/core/opiealarm/opiealarm.c
index a4d46ed..71367b3 100644
--- a/core/opiealarm/opiealarm.c
+++ b/core/opiealarm/opiealarm.c
@@ -228,8 +228,10 @@ int suspend ( int fix_rtc )
if ( log )
fprintf ( log, "Setting RTC alarm to %d\n", alrt );
+ tzset ( );
+
alr = *gmtime ( &alrt );
// get system time
time ( &syst );
@@ -239,12 +241,20 @@ int suspend ( int fix_rtc )
if (( fd = open ( "/dev/misc/rtc", O_RDWR )) < 0 )
error_msg_and_die ( 1, "/dev/misc/rtc" );
// get RTC time
+ memset ( &rtc, 0, sizeof ( struct tm ));
if ( ioctl ( fd, RTC_ALM_SET, &rtc ) < 0 )
error_msg_and_die ( 1, "ioctl RTC_RD_TIME" );
rtct = mktime ( &rtc );
+ fprintf ( log, "System time: %02d.%02d.%04d %02d:%02d:%02d DST: %d (TZ: %s, offset: %d)\n", sys. tm_mday, sys. tm_mon + 1, sys. tm_year + 1900, sys. tm_hour, sys. tm_min, sys. tm_sec, sys. tm_isdst, sys. tm_zone, sys. tm_gmtoff );
+ fprintf ( log, "RTC time: %02d.%02d.%04d %02d:%02d:%02d DST: %d (TZ: %s, offset: %d)\n", rtc. tm_mday, rtc. tm_mon + 1, rtc. tm_year + 1900, rtc. tm_hour, rtc. tm_min, rtc. tm_sec, rtc. tm_isdst, rtc. tm_zone, rtc. tm_gmtoff );
+ fprintf ( log, "Wakeup time: %02d.%02d.%04d %02d:%02d:%02d DST: %d (TZ: %s, offset: %d)\n", alr. tm_mday, alr. tm_mon + 1, alr. tm_year + 1900, alr. tm_hour, alr. tm_min, alr. tm_sec, alr. tm_isdst, alr. tm_zone, alr. tm_gmtoff );
+
+ fprintf ( log, "System/RTC diff: %d seconds\n", ( syst - rtct ) - sys. tm_gmtoff );
+
+
rtc_sys_diff = ( syst - rtct ) - sys. tm_gmtoff;
if ( fix_rtc && (( rtc_sys_diff < -4 ) || ( rtc_sys_diff > 4 ))) {
struct tm set;