+\r
+\r
+var\r
+ GetSystemTimePreciseAsFileTime:procedure(var v:tfiletime); stdcall;\r
+ win8inited:boolean;\r
+\r
+procedure initwin8;\r
+var\r
+ dllhandle:thandle;\r
+\r
+begin\r
+ win8inited := true;\r
+ dllhandle := loadlibrary('kernel32.dll');\r
+ if (dllhandle <> 0) then begin\r
+ GetSystemTimePreciseAsFileTime := getprocaddress(dllhandle,'GetSystemTimePreciseAsFileTime');\r
+ end;\r
+end;\r
+\r
+\r
+function unixtimefloat_win8:float;\r
+var\r
+ ft:tfiletime;\r
+ i:int64 absolute ft;\r
+begin\r
+ GetSystemTimePreciseAsFileTime(ft);\r
+ {change from windows 1601-01-01 to unix 1970-01-01.\r
+ use integer math for this, to preserve precision}\r
+ dec(i, 116444736000000000);\r
+ result := (i / 10000000);\r
+end;\r
+\r
+\r
+\r