/* Set the minutes and seconds from seconds value 'nowtime'. Fail if clock is out by > 30 minutes. Logic lifted from atari code.  */
static int q40_set_clock_mmss(unsigned long)
/* Set the minutes and seconds from seconds value 'nowtime'. Fail if clock is out by > 30 minutes. Logic lifted from atari code.  */
static int q40_set_clock_mmss(unsigned long)
{
	int retval = 0;
	short real_seconds = nowtime % 60, real_minutes = (nowtime / 60) % 60;
	int rtc_minutes;
	rtc_minutes = bcd2bin(Q40_RTC_MINS);
	if ((rtc_minutes < real_minutes ?
	     real_minutes - rtc_minutes :
	     rtc_minutes - real_minutes) < 30) {
		Q40_RTC_CTRL |= Q40_RTC_WRITE;
		Q40_RTC_MINS = bin2bcd(real_minutes);
		Q40_RTC_SECS = bin2bcd(real_seconds);
		Q40_RTC_CTRL &= ~(Q40_RTC_WRITE);
	} else
		retval = -1;
	return retval;
}