X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/3dd5a60c6c89a29781e099a9e204b09ffbb2e317..fed3bacaa7e5da92ab4cf44995b5a2bc26a81faa:/btime.pas diff --git a/btime.pas b/btime.pas index 46cdf48..a0bfc5e 100644 --- a/btime.pas +++ b/btime.pas @@ -176,9 +176,14 @@ end; function unixtimefloat:float; var tv:ttimeval; + sec:tunixtimeint; begin gettimeofday(tv); - result := tv.tv_sec+(tv.tv_usec/1000000); + sec := tv.tv_sec; + {$ifndef cpu64} + if (sec < 0) then inc(sec,$100000000); //tv_sec is 32 bits + {$endif} + result := sec+(tv.tv_usec/1000000); end; {$ifdef linux} @@ -263,9 +268,14 @@ end; function unixtimeint:tunixtimeint; var tv:ttimeval; + sec:tunixtimeint; begin gettimeofday(tv); - result := tv.tv_sec; + sec := tv.tv_sec; + {$ifndef cpu64} + if (sec < 0) then inc(sec,$100000000); //tv_sec is 32 bits + {$endif} + result := sec; end; {------------------------------ end of *nix/freepascal section}