[mercury-users] SEC: UNCLASSIFIED:-

Vic Bancroft bancroft at zvolve.com
Wed Oct 30 01:19:34 AEDT 2002


On Tue, 29 Oct 2002, Fergus Henderson wrote:

> On 29-Oct-2002, Ian.Sykes at defence.gov.au <Ian.Sykes at defence.gov.au> wrote:
 
> The accuracy of Mercury's time__times procedure is determined by
> the accuracy of the C function times() which is used to implement it.
> 
> The ElapsedRealTime returns a value in "clock ticks".
> These are not guaranteed to be centiseconds.

>From the man page on solaris,

  The  specific  value for  a  clock tick is defined by the variable CLK_TCK,
  found in the header <limits.h>.

This can be determined using the following c fragment,

  /** Determine the number of clock ticks per second on solaris.
   *  compile using:  gcc clktck.c -o clktck
   */

  #include <time.h>
  #include <limits.h>
  #include <stdio.h>

  int main ( int argc, char ** argv ) {
        printf( "Clock ticks per second (CLK_TCK) : %d\n", CLK_TCK );
  }

Unless you are using a realtime kernel, milliseconds may be the smallest
granularity commonly available.

> > Is there a better way of getting a more precise time interval?
> 
> Probably, but it depends on which platform you're using.
> Which platform are you using?  [...]
> On most platforms, there are C library functions for this sort of thing
> which you can access from Mercury using the C interface.

The usleep function takes time intervals specified in microseconds and some
systems (AIX) everything is _really_ implemented using nsleep which takes time
intervals specified as nanoseconds . . . 
 
more,
l8r,

------------------------------------------------------------------- 
Victor Bancroft, Principal Engineer, Zvolve Systems [v]770.551.4505 
1050 Crown Pointe Pkwy, Suite 300, Atlanta GA 30338 [f]770.551.4509 
Fellow, Artificial Intelligence Center              [v]706.542-0358 
Athens, Georgia  30602, U.S.A           http://ai.uga.edu/~bancroft 
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list