bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #30526] No match with a file with modified n days ago in "-mtime"


From: Norihirio Tanaka
Subject: [bug #30526] No match with a file with modified n days ago in "-mtime"
Date: Thu, 06 Oct 2011 10:55:21 +0000
User-agent: Mozilla/5.0 (Windows NT 6.0; rv:7.0.1) Gecko/20100101 Firefox/7.0.1

Follow-up Comment #4, bug #30526 (project findutils):

When you run `find' after run `touch', few nsecs has passed.
You need to apply following patch to ignore it, before test the problem.

--
 static double ts_difference(struct timespec ts1,
                            struct timespec ts2)
 {
-  double d =  difftime(ts1.tv_sec, ts2.tv_sec)
-    + (1.0e-9 * (ts1.tv_nsec - ts2.tv_nsec));
+  double d =  difftime(ts1.tv_sec, ts2.tv_sec);
+  printf ("** DEBUG ** d = %fn", d);
   return d;
 }
--

$ touch -d '1 day ago' recent ; ./find recent -mtime 0
** DEBUG ** d = 0.000000

$ touch -d '1 day ago' recent ; ./find recent -mtime -0
** DEBUG ** d = -86399.000000

$ touch -d '1 day ago' recent ; ./find recent -mtime +0
** DEBUG ** d = 0.000000

$ touch -d '1 day ago' recent ; ./find recent -mtime 1
** DEBUG ** d = 86400.000000
recent

$ touch -d '1 day ago' recent ; ./find recent -mtime -1
** DEBUG ** d = 1.000000
recent

$ touch -d '1 day ago' recent ; ./find recent -mtime +1
** DEBUG ** d = 86400.000000


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?30526>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]