It is currently Tue, 28 Sep 2021 12:11:43 GMT



 
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

Ralph A. Fernandes (rfer...@ssg1.com) wrote:
: 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
c...@crash.cts.com



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

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

 > c...@cts.com (Will Rose) wrote:
 >> 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 ] 

Similar Threads

1. Time out function in POSIX

2. How to display current time with millisecs

3. Does Linux have POSIX.4 time-functions?

4. POSIX newbie: POSIX function calls

5. posix message queues and other posix functions

6. time() function in time.h

7. Posix timer functions

8. a posix compliant function to read group database?

9. is lstat a POSIX function?

10. POSIX question about error returns from system functions


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software