X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstat-time.h;h=5fd18c1fac094dae47bbd02a3843415646089944;hb=53ed71f6a1cc4207b1972b73e4b5e1e830c8119d;hp=0e4efcea0612cc64271e2d85033d31aceefbf735;hpb=0fecb046139645c251a2f1c548280590f5f29126;p=gnulib.git diff --git a/lib/stat-time.h b/lib/stat-time.h index 0e4efcea0..5fd18c1fa 100644 --- a/lib/stat-time.h +++ b/lib/stat-time.h @@ -1,6 +1,6 @@ /* stat-related time functions. - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2007 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,7 +21,7 @@ #ifndef STAT_TIME_H #define STAT_TIME_H 1 -#include "timespec.h" +#include /* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST, @@ -31,7 +31,11 @@ These macros are private to stat-time.h. */ #if defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC -# define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) +# ifdef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC +# define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) +# else +# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec) +# endif #elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC # define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim##espec) #elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC @@ -127,52 +131,4 @@ get_stat_mtime (struct stat const *st) #endif } -/* Set *ST's access time. */ -static inline void -set_stat_atime (struct stat *st, struct timespec t) -{ -#ifdef STAT_TIMESPEC - STAT_TIMESPEC (st, st_atim) = t; -#else - st->st_atime = t.tv_sec; -# if defined STAT_TIMESPEC_NS - STAT_TIMESPEC_NS (st, st_atim) = t.tv_nsec; -# elif defined HAVE_STRUCT_STAT_ST_SPARE1 - st->st_spare1 = t.tv_nsec / 1000; -# endif -#endif -} - -/* Set *ST's status change time. */ -static inline void -set_stat_ctime (struct stat *st, struct timespec t) -{ -#ifdef STAT_TIMESPEC - STAT_TIMESPEC (st, st_ctim) = t; -#else - st->st_ctime = t.tv_sec; -# if defined STAT_TIMESPEC_NS - STAT_TIMESPEC_NS (st, st_ctim) = t.tv_nsec; -# elif defined HAVE_STRUCT_STAT_ST_SPARE1 - st->st_spare1 = t.tv_nsec / 1000; -# endif -#endif -} - -/* Set *ST's data modification time. */ -static inline void -set_stat_mtime (struct stat *st, struct timespec t) -{ -#ifdef STAT_TIMESPEC - STAT_TIMESPEC (st, st_mtim) = t; -#else - st->st_mtime = t.tv_sec; -# if defined STAT_TIMESPEC_NS - STAT_TIMESPEC_NS (st, st_mtim) = t.tv_nsec; -# elif defined HAVE_STRUCT_STAT_ST_SPARE1 - st->st_spare1 = t.tv_nsec / 1000; -# endif -#endif -} - #endif