POSIX function for time with millisecs 
Author Message
 POSIX function for time with millisecs

Is there a POSIX compliant function which returns the current time with
at-least a milli-second precision?  The gettimeofday() in sys/time.h is
not POSIX compliant (i.e. will not compile with _POSIX_C_SOURCE defined)

Thanks.
--
Ralph A. Fernandes
Systems Solutions Group
(510) 867 2900 x118
Fax:  867 2901



Mon, 13 Nov 2000 03:00:00 GMT  
 POSIX function for time with millisecs


: Is there a POSIX compliant function which returns the current time with
: at-least a milli-second precision?  The gettimeofday() in sys/time.h is
: not POSIX compliant (i.e. will not compile with _POSIX_C_SOURCE defined)

In POSIX, time() returns seconds since 1 Jan 70.  Anything else is
system-dependant.

Will



Mon, 13 Nov 2000 03:00:00 GMT  
 POSIX function for time with millisecs

Quote:

>In POSIX, time() returns seconds since 1 Jan 70.  Anything else is
>system-dependant.

What about clock_gettime(3). On Digital UNIX 3.2G, its man page claims that
the function is P1003.1b and returns the time in a struct timespec, giving
nanoseconds. Of course, the resolution of the clock and how often it updates
the system wall clock time is system dependant.

--
Ron.



Tue, 14 Nov 2000 03:00:00 GMT  
 POSIX function for time with millisecs


 >> In POSIX, time() returns seconds since 1 Jan 70.  Anything else is
 >> system-dependant.

 Ron> What about clock_gettime(3). On Digital UNIX 3.2G, its man page
 Ron> claims that the function is P1003.1b

That's the POSIX Realtime spec, not the core POSIX.1 standard. The
Single Unix spec defines the realtime functions as an optional feature
group.

In practice, gettimeofday() is more portable, though it isn't part of
POSIX.

--
Andrew.

comp.unix.programmer FAQ: see <URL: http://www.erlenstar.demon.co.uk/unix/>
                           or <URL: http://www.whitefang.com/unix/>



Wed, 15 Nov 2000 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. POSIX compliance and time functions

2. Info on POSIX times() needed

3. ANSI/POSIX functions

4. Visual C++ function equivalent to POSIX

5. Library Functions and the POSIX Standard

6. Emulation of POSIX functions

7. measuring millisecs

8. Millisecs?

9. timing routines/time functions

10. Looking for a time function/code to add 1 second to time structure

11. Calling DLL functions without known function name, parameter-list until run-time

12. Q: How to get time in millisecs under Win98 accurately?

 

 
Powered by phpBB® Forum Software