[ntp:questions] NTP client with ability to write Windows NT system time to hardware clock?

David J Taylor david-taylor at blueyonder.co.uk.invalid
Sun Dec 12 06:54:42 UTC 2010


"Brolin Empey" <brolin at brolin.be> wrote in message 
news:nSSMo.1329$317.1069 at newsfe20.iad...
[]
> My RTC already runs in UTC, but my RTC is approximately 2 minutes behind 
> because I have no way of writing the Windows NT system time to the 
> hardware clock (RTC) after using an NTP client to synchronise the 
> Windows NT system time.  On Ubuntu, I use ntpdate-debian + hwclock, but 
> I cannot find a real hwclock for Windows NT, only malware which uses the 
> name hwclock.exe as a disguise.  I need an hwclock.exe application for 
> Windows NT so I can run “hwclock --utc --systohc” like on Ubuntu.  I am 
> asking in this group because I thought someone may know of an NTP client 
> for Windows NT with this functionality, now that Microsoft has finally 
> fully fixed support for RealTimeIsUniversal=1 beginning in Windows Vista 
> SP2 + Windows 7.


Brolin,

If it helps, here is rather old code for DOS for reading the RTC.  I'm not 
sure how you would map the INT 26 (hex 1A) to Windows.  You may also need 
to give the program port mapping capabilities.

Cheers,
David


function from_bcd (bcd: byte): word;
begin
  from_bcd := 10 * ((bcd and $F0) shr 4) + (bcd and $0F);
end;


procedure get_rtc_time (var  h, m, s: word);
var
   r: Registers;
begin
  with r do
  begin
    ah := $02;  Intr ($1A, r);
    h := from_bcd (ch);
    m := from_bcd (cl);
    s := from_bcd (dh);
  end;
end;


procedure get_rtc_date (var  y, m, d: word);
var
   r: Registers;
begin
  with r do
  begin
    ah := $04;  Intr ($1A, r);
    y := 100*from_bcd (ch) + from_bcd (cl);
    m := from_bcd (dh);
    d := from_bcd (dl);
  end;
end; 




More information about the questions mailing list