Re: [fpc-pascal] question about FpTimes in BaseUnix package

2009-11-18 Thread Henry Vermaak
2009/11/17 Rainer Stratmann rainerstratm...@t-online.de:
 Am Tuesday 17 November 2009 19:34:19 schrieb Bruce Bauman:
 I am using the FpTimes function from the BaseUnix package. The
 documentation says it returns -1 on an error, otherwise the number of
 clock ticks since boot time.

 What does clock ticks exactly mean?
 I am searching for an equivalent to getticks in windows.

If you want to measure uptime, then you need to use sysinfo.  The
resolution is seconds, though.

Henry
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] question about FpTimes in BaseUnix package

2009-11-18 Thread Luca Olivetti

En/na Rainer Stratmann ha escrit:

Am Tuesday 17 November 2009 19:34:19 schrieb Bruce Bauman:

I am using the FpTimes function from the BaseUnix package. The
documentation says it returns -1 on an error, otherwise the number of
clock ticks since boot time.


What does clock ticks exactly mean?
I am searching for an equivalent to getticks in windows.


There isn't one.
Lazarus defines a compatibility GetTickCount as such:

Result := DWord(Trunc(Now * 24 * 60 * 60 * 1000));

it's not the same as windows' GetTickCount but it can be used if you 
just want to calculate elapsed time (provided the clock doesn't jump 
back/forward).


Bye
--
Luca
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] question about FpTimes in BaseUnix package

2009-11-17 Thread Jonas Maebe

On 17 Nov 2009, at 19:34, Bruce Bauman wrote:

 I am using the FpTimes function from the BaseUnix package. The
 documentation says it returns -1 on an error, otherwise the number of
 clock ticks since boot time. However, the return type of this function
 is TClock, which is unsigned.

From man 3 times:

If an
error occurs, times() returns the value ((clock_t)-1), and sets errno to
indicate the error.

So check against TClock(-1).


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] question about FpTimes in BaseUnix package

2009-11-17 Thread Rainer Stratmann
Am Tuesday 17 November 2009 19:34:19 schrieb Bruce Bauman:
 I am using the FpTimes function from the BaseUnix package. The
 documentation says it returns -1 on an error, otherwise the number of
 clock ticks since boot time.

What does clock ticks exactly mean?
I am searching for an equivalent to getticks in windows.
Rainer
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal