Mail Archives: djgpp/1997/12/16/01:44:08
Hi,
I have a strange problem with setting date and time in my program.
I read realtime clock by the mean of function :
int real_time_clock(int cmd,struct time *real_time)
{ __dpmi_regs r;
int tmp;
if (cmd==0) //read real time clock
{ r.h.ah = 0x2;
__dpmi_int(0x1a, &r);
real_time->ti_hour=bcd2bin(r.h.ch);
real_time->ti_min=bcd2bin(r.h.cl);
real_time->ti_sec=bcd2bin(r.h.dh);
real_time->ti_hund=0;
}
else
{ r.h.ah = 0x3;
r.h.ch=real_time->ti_hour;
r.h.cl=real_time->ti_min;
r.h.dh=real_time->ti_sec;
__dpmi_int(0x1a, &r);
}
return (1);
}
And then call settime() to synchronize real and system timers.
{ struct time now;
real_time_clock(0,&now);
settime(&now);
}
Everething is Ok until midnight - then time is 0:0:0 settime() increase
the date but then the time become 0:0:1 it sets date to the old
value :( What is my problem and how can I solve it ?
--
Regards,
Dim Zegebart,
Moscow Russia.
Ghostly basement : http://www.geocities.com/siliconvalley/pines/7817
DZCOMM - comm library for Allegro
- Raw text -