<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks Rainer, <br>
In the end I solved it using UnixToDateTime(FpTime), which is easier of
course...<br>
<br>
Rainer Stratmann schreef:
<blockquote cite="mid:200904101556.58413.RainerStratmann@t-online.de"
type="cite">
<pre wrap="">Am Freitag, 10. April 2009 16:47 schrieb Jan De Bleser:
You can try this. Not all uses are needed, you have to find out.
Rainer
uses
crt,
{$ifdef linux}
baseunix,
unix,
termio, // serial
linux,
sysutils,
dateutils,
unixutil;
{$else}
windows;
{$endif}
procedure mylo_os_gettime( var hour , minute , second , sec1000 : word );
var
{$ifdef linux} // LINUX
datetime : tdatetime;
{$else}
st : systemtime;
{$endif}
begin
{$ifdef linux} // LINUX
datetime := time;
hour := hourof( datetime );
minute := minuteof( datetime );
second := secondof( datetime );
sec1000 := millisecondof( datetime );
{$else} // WINDOWS
getlocaltime( st );
hour := st.whour;
minute := st.wminute;
second := st.wsecond;
sec1000 := st.wmilliseconds;
{$endif}
end;
procedure mylo_os_getdate( var year , month , day : word );
var
{$ifdef linux}
datetime : tdatetime;
{$else}
st : systemtime;
{$endif}
begin
{$ifdef linux}
datetime := date;
year := yearof( datetime );
month := monthof( datetime );
day := dayof( datetime );
{$else}
getlocaltime( st );
year := st.wyear;
month := st.wmonth;
day := st.wday;
{$endif}
end;
</pre>
<blockquote type="cite">
<pre wrap="">Hi,
How is it possible to get the system time in linux?
It used to be possible by using 'getsystemtime' of the unit oldlinux,
but this unit is no longer available on my compiler...
The thing I want to use it for is: I get a packet form libpcap, with the
time of receival in system time.
I want to convert this time to system time by doing something like:
rcvTime := packet.rcvTime + (now - getSystemTime)
Kind regards,
Jan
_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a>
</pre>
</blockquote>
<pre wrap=""><!---->_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a>
</pre>
</blockquote>
<br>
</body>
</html>