struct stat.h with nanosecond resolution

Ulrich Drepper drepper@redhat.com
Tue Dec 3 13:07:00 GMT 2002


Andreas Jaeger wrote:
> Ulrich Drepper <drepper@redhat.com> writes:
> 
> 
>>Andreas Jaeger wrote:
>>
>>
>>>This will not work since it clashes with struct timeval which is
>>>defined as:
>>
>>It just means we'll have to rename the members of timeval as well.
> 
> 
> Oh no, it's getting even uglier.

It's too much for my taste.

Let's fall back to not providing any struct when namespaces are
important.  I.e,. use something like


#ifdef __USE_GNU
  struct timespec st_atim;
#else
  time_t st_atime;
  unsigned long int st_atime_nsec;
#endif


Maybe add || defined __USE_BSD.  Depends on what the BSD crowds are
doing and whether it makes sense.  We also need a #define
__need_timespec at the top of <time.h> with the same #if expression.

The rationale is that in a POSIX/Unix up you better not depend on
st_atim in the first place, leave alone assigning it to some other variable.

This will avoid the ugly macro business.  And yes, defining
st_atime_nsec is perfectly alright.  We could consider using
__st_atime_nsec instead to indicate that nobody should use the name.

-- 
--------------.                        ,-.            444 Castro Street
Ulrich Drepper \    ,-----------------'   \ Mountain View, CA 94041 USA
Red Hat         `--' drepper at redhat.com `---------------------------



More information about the Libc-alpha mailing list