Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Library: Sonstiges (https://www.delphipraxis.net/45-library-sonstiges/)
-   -   Delphi SystemBootupTime (https://www.delphipraxis.net/107473-systembootuptime.html)

peschai 28. Jan 2008 13:20


SystemBootupTime
 
Hallo,
gibt die SystemBootupTime zurück. Funktioniert auch bei mehr als 47 Tagen (Einschränkung bei GetTickCount...)

Delphi-Quellcode:
function fctSystemBootUpTime: TDateTime;
var
  n1, n2: Int64;
begin
  // local init
  Result := 0.0;
  n1 := 0;
  n2 := 0;
  // local main
  if QueryPerformanceFrequency(n1) and QueryPerformanceCounter(n2) then
    begin
      if (n1<>0) and (n2<>0)
        then Result := Now - ( (n2 / n1) / 86400);
    end;
end;
[edit=Matze]Überarbeitete Version eingefügt. MfG, Matze[/edit]


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:45 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz