X-Git-Url: http://www.lcore.org/git/lcore.git/blobdiff_plain/ac385c745f6e299bea549eb2006b803e3885c916..ba45339b0cda696438a3b1553c829445fd894641:/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}