Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Library: Sonstiges (https://www.delphipraxis.net/45-library-sonstiges/)
-   -   Delphi Aktuelle Systemzeit als UnixTime(-Stamp) (https://www.delphipraxis.net/8431-aktuelle-systemzeit-als-unixtime-stamp.html)

Proddi 4. Sep 2003 14:45


Aktuelle Systemzeit als UnixTime(-Stamp)
 
Für alle die, die die aktuelle Systemzeit als Unix-Timestamp brauchen:
Daraus lässt sich nat. auch eine beliebige Zeit in UnixTime wandeln...
Delphi-Quellcode:
function GetUnixTime: int64;
var
  st:_SYSTEMTIME;
  ft:_FILETIME;
begin
  // first get windows SYSTEMTIME in UTC / GMT
  GetSystemTime(st);
  // now convert to windows FILETIME
  SystemTimeToFileTime(st, ft);
  // now to UNIXTIME
  result := round((int64(ft) - int64(116444736000000000)) / 10000000);
end;
[edit=Daniel B]Delphi-Tags korrigiert. Mfg, Daniel B[/edit]
[edit=Chakotay1308]Funktion korrigiert. Mfg, Chakotay1308[/edit]
[edit=Matze]Code formatiert. Mfg, Matze[/edit]
[edit=Chakotay1308]Klassifizierung. Mfg, Chakotay1308[/edit]
[edit=fkerber]Neu abgespeichert wg. Code-Highlighting. Mfg, fkerber[/edit]


Alle Zeitangaben in WEZ +1. Es ist jetzt 14:42 Uhr.

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