Re: Future version 1.27 of the "World Map" #future


jdow
 


On 20220511 02:29:40, David J Taylor via groups.io wrote:
On 11/05/2022 09:37, jdow wrote:
time_t timeGetTime(); That has millisecond resolution - if running with mm
timer set to 1 ms. Then there is the precision (100ns) timer with motherboard
dependent actual resolution. I use timeGetTime() most of the time. One must
handle it's roll over, of course. With time64_to work with on 64 bit builds
that's not much of a problem. It is always a relative time to when the computer
boots. But that offset can be backed out if critical.

{^_^}


For getting the UTC I use the precise function where it is available, which
should be Windows-8 ans later.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

function NowUTCprecise: TDateTime;

  function FTtoDateTime (const ft: TFileTime): TDateTime;
  type
    TFT = record case integer of
            0: (ft: TFileTime);
            1: (i64: int64);
          end;
  var
    ft64: TFT;
    dt: TDateTime;
    offset: TDateTime;
  begin
    ft64.ft := ft;
    dt := ft64.i64;
    dt := dt / (1E7 * 86400);
    offset := EncodeDate (1601, 1, 1);
    Result := dt + offset;
  end;

var
  ft: TFileTime;
begin
  FPreciseFT (ft);
  Result := FTtoDateTime (ft);
end;

In the initialisation use the best available:

  FKernel32 := LoadLibrary ('kernel32.dll');
  if FKernel32 <> 0 then
    begin
    FPreciseFT := GetProcAddress (FKernel32, 'GetSystemTimePreciseAsFileTime');
    if @FPreciseFT = nil then
      FPreciseFT := GetProcAddress (FKernel32, 'GetSystemTimeAsFileTime');
    end;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Using NTP with a PPS source gives much better than 1 millisecond keeping:

  https://www.satsignal.eu/mrtg/harstad_ntp_2.html
  https://www.satsignal.eu/mrtg/stamsund_ntp_2.html

A Raspberry Pi with a GPS/PPS hat can make an ideal local NTP server, for example:


https://store.uputronics.com/index.php?route=product/product&path=64&product_id=81

(hit by the chip shortage).

73,
David GM8ARV
--
SatSignal Software - Quality software for you
Web: https://www.satsignal.eu
Email: david-taylor@...
Twitter: @gm8arv


The performance counter has been available for a very long time. GetSystemTimePreciseAsFileTime() is an added function that means you do not have to invent your own. Remember that this only reads the time when you call the function. This may be several ms from when the data came in on an io port buffer. There are no free lunches, unfortunately.

{^_^}

Join main@SDR-Radio.groups.io to automatically receive all group messages.