delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/16/01:44:08

Message-ID: <349622D3.1E4C@post.comstar.ru>
Date: Tue, 16 Dec 1997 09:42:27 +0300
From: Dim Zegebart <zager AT post DOT comstar DOT ru>
Reply-To: zager AT post DOT comstar DOT ru
Organization: Comstar Ltd.
MIME-Version: 1.0
To: DJGPP Mail List <djgpp AT delorie DOT com>
Subject: Time and Date problem

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019