Stepan Kasal wrote:
> the top of m4/stat-time.m4 says:
>
> # st_atim.tv_nsec - Linux, Solaris, Cygwin
> # st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE
> # st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE
> # st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1)
>
> But my GNU libc.info mentiones st_atimensec, but not st_atim.
Please look at the actual header files, not only at the documentation.
Among the bits/stat.h files in glibc,
- those for Linux have this code:
#ifdef __USE_MISC
/* Nanosecond resolution timestamps are stored in a format
equivalent to 'struct timespec'. This is the type used
whenever possible but the Unix namespace rules do not allow the
identifier 'timespec' to appear in the header.
Therefore we have to handle the use of this header in strictly
standard-compliant sources special. */
struct timespec st_atim;/* Time of last access. */
struct timespec st_mtim;/* Time of last modification. */
struct timespec st_ctim;/* Time of last status change. */
# define st_atime st_atim.tv_sec/* Backward compatibility. */
# define st_mtime st_mtim.tv_sec
# define st_ctime st_ctim.tv_sec
#else
__time_t st_atime; /* Time of last access. */
unsigned long int st_atimensec; /* Nscecs of last access. */
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtimensec; /* Nsecs of last modification. */
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctimensec; /* Nsecs of last status change. */
#endif
And __USE_MISC is normally enabled by _GNU_SOURCE.
- those for Hurd and BSD have this code:
__time_t st_atime; /* Time of last access. */
unsigned long int st_atime_usec;
__time_t st_mtime; /* Time of last modification. */
unsigned long int st_mtime_usec;
__time_t st_ctime; /* Time of last status change. */
unsigned long int st_ctime_usec;
> So it seems that platforms using GNU libc (GNU/Linux, Cygwin?) are
> converging towards POSIX.
I don't see much convergence here.
> Yes, this is a minor problem, but if this mail makes one of the
> portability wizards to do a rough adjustment of the comment, it might
> helt to the others.
Not only the comment. Also, glibc's st_atime_usec is not handled. But I
don't know whether it's actually filled.
Bruno