lcore.org gitweb
/
lcore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
oletounix should round so seconds do not go one off in conversion
[lcore.git]
/
ltimevalstuff.pas
diff --git
a/ltimevalstuff.pas
b/ltimevalstuff.pas
old mode 100755
(executable)
new mode 100644
(file)
index
bf9767e
..
7054ea9
--- a/
ltimevalstuff.pas
+++ b/
ltimevalstuff.pas
@@
-3,41
+3,45
@@
which is included in the package
\r
----------------------------------------------------------------------------- }
\r
\r
which is included in the package
\r
----------------------------------------------------------------------------- }
\r
\r
+{$ifdef fpc}
\r
+ {$mode delphi}
\r
+{$endif}
\r
+
\r
unit ltimevalstuff;
\r
interface
\r
unit ltimevalstuff;
\r
interface
\r
-
-{$ifdef
win32}
- type
- ttimeval = record
- tv_sec : longint;
- tv_usec : longint;
- end;
-{$else}
- {$ifdef ver1_0}
- uses linux;
- {$else}
- uses baseunix,unix
;
- {$endif}
-{$endif}
-
+
\r
+{$ifdef
mswindows}
\r
+ type
\r
+ ttimeval = record
\r
+ tv_sec : longint;
\r
+ tv_usec : longint;
\r
+ end;
\r
+{$else}
\r
+ {$ifdef ver1_0}
\r
+ uses linux;
\r
+ {$else}
\r
+ uses baseunix,unix
,unixutil,sockets;
\r
+ {$endif}
\r
+{$endif}
\r
+
\r
\r
procedure tv_add(var tv:ttimeval;msec:integer);
\r
function tv_compare(const tv1,tv2:ttimeval):boolean;
\r
\r
procedure tv_add(var tv:ttimeval;msec:integer);
\r
function tv_compare(const tv1,tv2:ttimeval):boolean;
\r
-procedure tv_sub
s
tract(var tv:ttimeval;const tv2:ttimeval);
\r
+procedure tv_subtract(var tv:ttimeval;const tv2:ttimeval);
\r
procedure msectotimeval(var tv:ttimeval;msec:integer);
\r
procedure msectotimeval(var tv:ttimeval;msec:integer);
\r
-
+
\r
//tv_invalidtimebig will always compare as greater than any valid timeval
\r
//tv_invalidtimebig will always compare as greater than any valid timeval
\r
-//unfortunately unixstuff.inc hasn't worked it's magic yet so we
+//unfortunately unixstuff.inc hasn't worked it's magic yet so we
\r
//have to ifdef this manually.
\r
const
\r
//have to ifdef this manually.
\r
const
\r
- {$ifdef ver1_0}
+ {$ifdef ver1_0}
\r
tv_invalidtimebig : ttimeval = (sec:maxlongint;usec:maxlongint);
\r
tv_invalidtimebig : ttimeval = (sec:maxlongint;usec:maxlongint);
\r
- {$else}
-
\r
tv_invalidtimebig : ttimeval = (tv_sec:maxlongint;tv_usec:maxlongint);
\r
-
\r
{$endif}
+ {$else}
\r
+ tv_invalidtimebig : ttimeval = (tv_sec:maxlongint;tv_usec:maxlongint);
\r
+ {$endif}
\r
implementation
\r
implementation
\r
-
-{$i unixstuff.inc}
+
\r
+{$i unixstuff.inc}
\r
\r
{add nn msec to tv}
\r
procedure tv_add(var tv:ttimeval;msec:integer);
\r
\r
{add nn msec to tv}
\r
procedure tv_add(var tv:ttimeval;msec:integer);
\r
@@
-55,7
+59,7
@@
begin
end else result := tv1.tv_sec > tv2.tv_sec;
\r
end;
\r
\r
end else result := tv1.tv_sec > tv2.tv_sec;
\r
end;
\r
\r
-procedure tv_sub
s
tract(var tv:ttimeval;const tv2:ttimeval);
\r
+procedure tv_subtract(var tv:ttimeval;const tv2:ttimeval);
\r
begin
\r
dec(tv.tv_usec,tv2.tv_usec);
\r
if tv.tv_usec < 0 then begin
\r
begin
\r
dec(tv.tv_usec,tv2.tv_usec);
\r
if tv.tv_usec < 0 then begin
\r