-/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
if (SCM_UNBNDP (actime))
{
-#if HAVE_UTIMENSAT
+#ifdef HAVE_UTIMENSAT
atim_sec = 0;
atim_nsec = UTIME_NOW;
#else
if (SCM_UNBNDP (modtime))
{
-#if HAVE_UTIMENSAT
+#ifdef HAVE_UTIMENSAT
mtim_sec = 0;
mtim_nsec = UTIME_NOW;
#else
else
f = SCM_NUM2INT (6, flags);
-#if HAVE_UTIMENSAT
+#ifdef HAVE_UTIMENSAT
{
struct timespec times[2];
times[0].tv_sec = atim_sec;
times[1].tv_nsec = mtim_nsec;
STRING_SYSCALL (pathname, c_pathname,
- rv = utimensat (AT_FDCWD, c_pathname, ×, f));
+ rv = utimensat (AT_FDCWD, c_pathname, times, f));
}
#else
{
;;;; posix.test --- Test suite for Guile POSIX functions. -*- scheme -*-
;;;;
-;;;; Copyright 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+;;;; Copyright 2003, 2004, 2006, 2007, 2010 Free Software Foundation, Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
(throw 'unsupported)
(ttyname file)))))
+;;
+;; utimes
+;;
+
+(with-test-prefix "utime"
+ (pass-if "valid argument (second resolution)"
+ (let ((file "posix.test-utime"))
+ (dynamic-wind
+ (lambda ()
+ (close-port (open-output-file file)))
+ (lambda ()
+ (let* ((accessed (+ (current-time) 3600))
+ (modified (- accessed 1000)))
+ (utime file accessed modified)
+ (let ((info (stat file)))
+ (and (= (stat:atime info) accessed)
+ (= (stat:mtime info) modified)))))
+ (lambda ()
+ (delete-file file))))))