lcore.org gitweb
/
lcore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make unixtimeint and unixtimefloat work after 2038 on 32 bits unix. timezone is still...
[lcore.git]
/
btime.pas
diff --git
a/btime.pas
b/btime.pas
index 46cdf48a74189538993306a5985bd3fa7fa996c2..a0bfc5eaa012fe9e030565bf82150ce35a95c8e4 100644
(file)
--- a/
btime.pas
+++ b/
btime.pas
@@
-176,9
+176,14
@@
end;
function unixtimefloat:float;
\r
var
\r
tv:ttimeval;
\r
function unixtimefloat:float;
\r
var
\r
tv:ttimeval;
\r
+ sec:tunixtimeint;
\r
begin
\r
gettimeofday(tv);
\r
begin
\r
gettimeofday(tv);
\r
- result := tv.tv_sec+(tv.tv_usec/1000000);
\r
+ sec := tv.tv_sec;
\r
+ {$ifndef cpu64}
\r
+ if (sec < 0) then inc(sec,$100000000); //tv_sec is 32 bits
\r
+ {$endif}
\r
+ result := sec+(tv.tv_usec/1000000);
\r
end;
\r
\r
{$ifdef linux}
\r
end;
\r
\r
{$ifdef linux}
\r
@@
-263,9
+268,14
@@
end;
function unixtimeint:tunixtimeint;
\r
var
\r
tv:ttimeval;
\r
function unixtimeint:tunixtimeint;
\r
var
\r
tv:ttimeval;
\r
+ sec:tunixtimeint;
\r
begin
\r
gettimeofday(tv);
\r
begin
\r
gettimeofday(tv);
\r
- result := tv.tv_sec;
\r
+ sec := tv.tv_sec;
\r
+ {$ifndef cpu64}
\r
+ if (sec < 0) then inc(sec,$100000000); //tv_sec is 32 bits
\r
+ {$endif}
\r
+ result := sec;
\r
end;
\r
\r
{------------------------------ end of *nix/freepascal section}
\r
end;
\r
\r
{------------------------------ end of *nix/freepascal section}
\r