This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: nanosecond support for stat


On 01/12/2012 12:33 PM, Mike Stump wrote:
> I'd like nanosecond time for stat, seems trivial and enough.  I want to submit some binutils patches for the simulator to make use of these.
> 
> The style and names are taken from linux.  Let me know if these go in.
> 
> Index: newlib/newlib/libc/include/sys/stat.h
> ===================================================================
> --- newlib/newlib/libc/include/sys/stat.h       (revision 1988)
> +++ newlib/newlib/libc/include/sys/stat.h       (working copy)
> @@ -46,11 +46,11 @@ struct      stat
>    time_t       st_ctime;
>  #else
>    time_t       st_atime;
> -  long         st_spare1;
> +  unsigned long        st_atimensec;

Actually, it would be better to go with the definitions given by POSIX:

struct timespec st_atim Last data access timestamp.
...
For compatibility with earlier versions of this standard, the st_atime
macro shall be defined with the value st_atim.tv_sec.

(and so forth for ctime and mtime).  This works if struct timespec is
layout-compatible with time_t followed by long; if not, then we've got
bigger problems to resolve first.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]