mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Use utimensat() to set file modification date, if available.
This commit is contained in:
parent
e23ab3b394
commit
21c79c3500
5 changed files with 29 additions and 7 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2010-05-01 Riccardo Mottola <rm@gnu.org>
|
||||
|
||||
* configure
|
||||
* configure.ac
|
||||
* Headers/GNUstepBase/config.h.in
|
||||
Check for utimensat()
|
||||
|
||||
* Source/NSFileManager.m: (changeFileAttributes:)
|
||||
Use utimensat() to set file modification date, if available.
|
||||
|
||||
2020-04-26 Fred Kiefer <fredkiefer@gmx.de>
|
||||
|
||||
* Source/NSLocale.m: Respect NSLocaleCalendarIdentifier if
|
||||
|
|
|
@ -755,6 +755,9 @@
|
|||
/* Define to 1 if you have the `usleep' function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define to 1 if you have the `utimensat' function. */
|
||||
#undef HAVE_UTIMENSAT
|
||||
|
||||
/* Define to 1 if you have the <utime.h> header file. */
|
||||
#undef HAVE_UTIME_H
|
||||
|
||||
|
|
|
@ -569,8 +569,9 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
BOOL ok = NO;
|
||||
struct _STATB sb;
|
||||
|
||||
#if defined(_WIN32) || defined(_POSIX_VERSION)
|
||||
#if defined (HAVE_UTIMENSAT)
|
||||
struct timespec ub[2];
|
||||
#elif defined(_WIN32) || defined(_POSIX_VERSION)
|
||||
struct _UTIMB ub;
|
||||
#else
|
||||
time_t ub[2];
|
||||
|
@ -588,13 +589,21 @@ static NSStringEncoding defaultEncoding;
|
|||
#endif
|
||||
else
|
||||
{
|
||||
#if defined(_WIN32) || defined(_POSIX_VERSION)
|
||||
NSTimeInterval ti = [date timeIntervalSince1970];
|
||||
#if defined (HAVE_UTIMENSAT)
|
||||
ub[0].tv_sec = 0;
|
||||
ub[0].tv_nsec = UTIME_OMIT; // we don't touch access time
|
||||
ub[1].tv_sec = truncl(ti);
|
||||
ub[1].tv_nsec = (ti - (double)ub[1].tv_sec) * 1.0e6;
|
||||
|
||||
ok = (utimensat(0, lpath, ub, 0) == 0);
|
||||
#elif defined(_WIN32) || defined(_POSIX_VERSION)
|
||||
ub.actime = sb.st_atime;
|
||||
ub.modtime = [date timeIntervalSince1970];
|
||||
ub.modtime = ti;
|
||||
ok = (_UTIME(lpath, &ub) == 0);
|
||||
#else
|
||||
ub[0] = sb.st_atime;
|
||||
ub[1] = [date timeIntervalSince1970];
|
||||
ub[1] = ti;
|
||||
ok = (_UTIME(lpath, ub) == 0);
|
||||
#endif
|
||||
}
|
||||
|
|
2
configure
vendored
2
configure
vendored
|
@ -8692,7 +8692,7 @@ _ACEOF
|
|||
|
||||
fi
|
||||
|
||||
for ac_func in statvfs link symlink readlink geteuid getlogin getpwnam getpwnam_r getpwuid getpwuid_r getgrgid getgrgid_r getgrnam getgrnam_r rint getopt malloc_usable_size
|
||||
for ac_func in utimensat statvfs link symlink readlink geteuid getlogin getpwnam getpwnam_r getpwuid getpwuid_r getgrgid getgrgid_r getgrnam getgrnam_r rint getopt malloc_usable_size
|
||||
do :
|
||||
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
||||
|
|
|
@ -2228,7 +2228,7 @@ AC_CHECK_HEADERS([sys/mount.h], [], [],
|
|||
AC_CHECK_HEADERS(sys/types.h windows.h locale.h langinfo.h)
|
||||
saved_LIBS="$LIBS"
|
||||
AC_CHECK_LIB(m, main)
|
||||
AC_CHECK_FUNCS(statvfs link symlink readlink geteuid getlogin getpwnam getpwnam_r getpwuid getpwuid_r getgrgid getgrgid_r getgrnam getgrnam_r rint getopt malloc_usable_size)
|
||||
AC_CHECK_FUNCS(utimensat statvfs link symlink readlink geteuid getlogin getpwnam getpwnam_r getpwuid getpwuid_r getgrgid getgrgid_r getgrnam getgrnam_r rint getopt malloc_usable_size)
|
||||
LIBS="$saved_LIBS"
|
||||
|
||||
AC_CACHE_CHECK([for pw_gecos field in struct passwd],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue