[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#3261: apmd incorrectly sets clock for some systems.



Package: apmd
Version: 2.4-1

Those APM users who have their system clocks set to GMT will notice an
annoying problem with apmd.  When resuming from suspension mode, the
daemon uses "clock -s" to reset the internal clock, which is incorrect
for clocks set to GMT (unless the user is in Greenwich).  The "-u"
flag must be used to inform the clock utility that the CMOS clock is
set to Universal Time.

As far as I know, the only thing in the Debian system that indicates
whether the CMOS clock is set to local time or GMT is the status of
the GMT variable in the /etc/init.d/boot file, which is set to "-u" if
Universal Time is used.  Perhaps there should be another way of
storing this information.

Here is one way to fix apmd for Debian systems:

--- apmd.c.orig	Sun Apr 21 16:49:56 1996
+++ apmd.c	Mon Jun 10 19:00:10 1996
@@ -348,7 +348,8 @@
 	 case APM_UPDATE_TIME:
 	 case APM_CRITICAL_RESUME:
 	    time( &then );
-	    system( "clock -s" );
+	    system( "if grep -q '^GMT=\"-u\"' /etc/init.d/boot; then"
+		    " clock -us; else clock -s; fi" );
 	    time( &now );
 	    check_power( 1, 0 );
 	    break;

--
Brian <brian@debian.org>


Reply to: