Http://docwiki.embarcadero.com/RADStudio/Seattle/en/Internal_Data_Formats
About the RTL function of double, as if it were one: trystrtofloat
function trystrtofloat (const s:string; out value:double): Boolean; overload;
function trystrtofloat (const s:string; out value:double; Const formatsettings:tformatsettings): Boolean; overload;
Fortunately, it can also be converted in the specified format, good luck.
--------------------------------------------------------------------------------------------------------------- -----------
By the way, review the usage of the Absolute keyword:
functionDoubletohex (Constd:double):string;varOverlay:Array[1..2] ofLongintAbsoluteD;begin Try //"Little Endian" orderRESULT: = Inttohex (overlay[2],8) + Inttohex (overlay[1],8); except End;End
Where API function FileTimeToSystemTime fetch time, need to use Delphi to provide the Systemtimetodatetime function to do the conversion, To get the Delphi custom Tdatetime data (the date in Delphi is stored using a double type, the integer part represents the number of days from "1899-12-30", and the fractional part represents the hour.) such as "2.75" This value means "1900-1-1 6:00pm", "1.25" means "1899-12-29 AM")
functionGETFILETIMESUTC (ConstFileName:string): Tdatetime;varSystemtime:tsystemtime; Finddata:win32_find_dataw; Findhandle:thandle; fn:string;beginResult:=0; Findhandle:=Invalid_handle_value; Findhandle:=Findfirstfilew (Strchemintounicode (FN), FindData); ifFindhandle <> Invalid_handle_value Then ifFileTimeToSystemTime (Finddata.ftlastwritetime, SystemTime) Then beginResult:=Systemtimetodatetime (SystemTime); End; ifFindhandle <> Invalid_handle_value ThenWindows.findclose (findhandle);End;
Like this number:
2014-07-07, 09:31:25, after commissioning, the Tdatetime value in Delphi is: 41827.355157 (the number of days before the decimal point, the hour after the decimal point)
The time Tdatetime is equivalent to double, that is, doubles the number 64 bits, finally found that it uses 11 bits to represent the precision of the e,53 bit (integer decimals together), the first one indicates positive or negative