nanosecond support for stat

Eric Blake eblake@redhat.com
Thu Jan 12 23:07:00 GMT 2012


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20120112/1276f81c/attachment.sig>


More information about the Newlib mailing list