2 # vim: filetype=sh noexpandtab ts=8 sw=8
5 desc="utimensat with UTIME_NOW will set the will set typestamps to now"
16 TIME_MARGIN=300 # Allow up to a 5 minute delta between the timestamps
18 expect 0 mkdir ${n1} 0755
23 create_file regular ${n0}
24 old_mtime=`$fstest lstat ${n0} mtime`
25 old_atime=`$fstest lstat ${n0} atime`
26 sleep 1 # Ensure that future timestamps will be different than this one
28 expect 0 open . O_RDONLY : utimensat 0 ${n0} 0 UTIME_NOW 0 UTIME_NOW 0
29 new_mtime=`$fstest lstat ${n0} mtime`
30 new_atime=`$fstest lstat ${n0} atime`
31 delta_mtime=$(( $new_mtime - $old_mtime ))
32 delta_atime=$(( $new_atime - $old_atime ))
34 if [ "$delta_mtime" -gt 0 ]; then
35 if [ "$delta_mtime" -lt $TIME_MARGIN ]; then
38 echo "not ok 4 new mtime is implausibly far in the future"
41 echo "not ok 4 mtime was not updated"
43 if [ "$delta_atime" -gt 0 ]; then
44 if [ "$delta_atime" -lt $TIME_MARGIN ]; then
47 echo "not ok 5 new atime is implausibly far in the future"
50 echo "not ok 5 atime was not updated"