utimes() and gettimeofday() prototypes - where?

utimes() and gettimeofday() prototypes - where?

Post by Thomas Wo » Tue, 11 May 1993 21:22:46



I should probably be embarrased to ask this, but I'll do it anyway :-)

Where are the these functions declared?  I grep'ed /usr/include and /usr/include/sys
and couldn't find anything....

Any info is much appreciated,
Tom

---
+----------------------------------------+ With so many signatures out in the
| Thomas Wolf   | (908) 957-3955         | internet, it's becoming nearly


+----------------------------------------+
Disclaimer: I write what's on my mind; please don't make the assumption that
what I write reflects my employer's ideas on the subject.

 
 
 

utimes() and gettimeofday() prototypes - where?

Post by Syed Zaeem Hosa » Wed, 12 May 1993 01:56:20



Quote:>I should probably be embarrased to ask this, but I'll do it anyway :-)

>Where are the these functions declared?  I grep'ed /usr/include and /usr/include/sys
>and couldn't find anything....

Interesting. On my SunOS 4.1.3 station (I assumed that you were looking
on Solaris 2.x based on the newsgroup this post of yours is in), the
man page page implies that gettimeofday should be in the directory
/usr/include/sys/time.h, and utimes should be in /usr/include/sys/types.h
but I could not find it declared in any of the .h files in the entire
/usr/include tree either (went looking with find)!

                                                                Z

--
-------------------------------------------------------------------------
| Syed Zaeem Hosain          P. O. Box 610097            (408) 441-7021 |

-------------------------------------------------------------------------

 
 
 

utimes() and gettimeofday() prototypes - where?

Post by Guy Harr » Tue, 18 May 1993 06:08:28


Quote:>Interesting. On my SunOS 4.1.3 station (I assumed that you were looking
>on Solaris 2.x based on the newsgroup this post of yours is in), the
>man page page implies that gettimeofday should be in the directory
>/usr/include/sys/time.h, and utimes should be in /usr/include/sys/types.h

...or, at least, you inferred that from the man page.

The #includes in UNIX man page SYNOPSIS sections for functions
unfortunately aren't guaranteed to declare the function itself; they may
merely define the data types used in the arguments to the functions.

The include file <sys/time.h> defines "struct timeval", which is why
it's in the "gettimeofday()" manual page; it should also be in the
"utimes()" manual page, rather than <sys/types.h>, for the same reason,
but unfortunately the "utimes()" manual page is in error.

With the advent of function prototypes, hopefully UNIX systems will,
over time, clean up their acts and have declarations for *all* the
functions in their APIs.

 
 
 

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

 man gettimeofday
Reformatting page.  Wait... done

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

NAME
     gettimeofday, settimeofday - get or set the date and time

SYNOPSIS
     #include <sys/time.h>

     int gettimeofday(struct timeval *tp);

....

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

What is  void* for?

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

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

--
        - Bill

2. Linux 2.5.15-dj2

3. utime vs utimes

4. Installation-Netgear FS310TX Ethernet

5. don't allow utime()/utimes() on immutable/append-only files

6. IOMEGA TRAVAN TAPE DRIVE

7. utime & utimes & POSIX & portability

8. TeX without xdvi??

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

10. Matrox Mystique ands X.

11. How to change utime of a file

12. procfs-utime-2.5.62-B0

13. utime for symbolic links??