gettimeofday prototype in /usr/include/sys/time.h on Solaris 2.4

gettimeofday prototype in /usr/include/sys/time.h on Solaris 2.4

Post by William A. Hoffm » Thu, 25 May 1995 04:00:00

 man gettimeofday
Reformatting page.  Wait... done

gettimeofday(3C)       C Library Functions       gettimeofday(3C)

     gettimeofday, settimeofday - get or set the date and time

     #include <sys/time.h>

     int gettimeofday(struct timeval *tp);


#ifdef __cplusplus
int gettimeofday(struct timeval *, void *);
int settimeofday(struct timeval *, void *);

What is  void* for?

This makes it very hard to write code that compiles on other machines.

#ifdef Solaris24
#elseif SYSV
gettimeofday(time, timezone);

        - Bill


gettimeofday prototype in /usr/include/sys/time.h on Solaris 2.4

Post by Casper H.S. D » Fri, 26 May 1995 04:00:00

Quote:>What is  void* for?

The second argument of gettimeofday use to be a "struct timezone *"
from the time when the kernel kept the timezone.  This parameter
is now obsolete and gettimeofday no longer needs a second parameter
so it was dropped in teh SVID (I think).  It's been added back
as a dummy parameter in the latest X/Open spec.

Quote:>This makes it very hard to write code that compiles on other machines.

Why do you make a difference between SYSV and Solaris24??

Quote:>#ifdef Solaris24
>#elseif SYSV

I'd suggest passing "NULL" as second argument, if a second argument is

I'd prefer a prototype either with one argument over one with two
arguments.  Programs that expect a timezone parameter to be filled in with
a non-bogus value should break so they can be fixed.  But the standard
apparently is differnt.

Casper Dik - Network Security Engineer - Sun Microsystems
This article is posted from my guest account at the University

Opinions expressed here are mine (but you're welcome to share them with me)


1. /usr/include vs /usr/include/sys


I'm wondering why some header files are found in both /usr/include and
/usr/include/sys.  I get the feeling that the include files in the
/sys directory are more platform specific, is this correct?  For
example on AIX /usr/include/time.h specifies the nanosleep() function
as defined by POSIX, but /usr/include/sys/time.h doesn't (it does
however have an nsleep() function).  What gives?


2. Password prompt from ppp script]

3. One more time: /usr/include/linux, /usr/include/asm

4. SNOOPING: How is it done?

5. gettimeofday(struct timeval *tp) but is in 2.4 gettimeofday(tp,tzp)

6. xterms default behaviour for shells (sorry, once again)

7. /usr/include/sys/cg2reg.h and Solaris 7?

8. Sony LCD M51 compatible with Linux XWindows?

9. Solaris 2.5: Missing /usr/include/sys/fbio.h ??

10. Tuning ufs on /, /var, /usr at install time (Solaris 2.4)

11. /usr/include/libelf.h prototypes - missing symbols

12. Solaris 2.6 patch or /usr/include/time.h?

13. Help - clashes between /usr/include and /usr/include/linux