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

Re: [Q] how to deal with 'clock vs hwclock' call



Dirk Eddelbuettel <edd@debian.org> writes:

> I had a bug reported against apmd because apmd.c somewhat hackishly calls
> clock(8) as per
>
>          case APM_CRITICAL_RESUME:
>             time( &then );
>             system( "clock -s" );
>             time( &now );
>             check_power( 1, 0 );
>             break;

Odd, I don't seem to have a clock(8) or a /usr/s?bin/clock.

And I don't quite see why this call has to be there. The kernel already does
what I think you're trying to do:

	case APM_NORMAL_RESUME:
	case APM_CRITICAL_RESUME:
	case APM_STANDBY_RESUME:
		set_time();
		send_event(event, 0, NULL);
		break;

Where set_time() is:

static void set_time(void)
{
	unsigned long	flags;

	if (!got_clock_diff)	/* Don't know time zone, can't set clock */
		return;

	save_flags(flags);
	cli();
	CURRENT_TIME = get_cmos_time() + clock_cmos_diff;
	restore_flags(flags);
}


greg


--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: