Whamcloud - gitweb
debugfs: interpret date strings of the form @dddd
authorTheodore Ts'o <tytso@mit.edu>
Tue, 12 Jun 2012 02:02:17 +0000 (22:02 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 12 Jun 2012 02:02:17 +0000 (22:02 -0400)
Debugfs will now interpret date strings of the form @123 as 123
seconds after the start of the epoch.  This is handy when editing an
orphan inode linked list using the inode's deletion time field.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
debugfs/util.c

index b07a8cc..cf3a6c6 100644 (file)
@@ -220,6 +220,13 @@ extern time_t string_to_time(const char *arg)
        if (strcmp(arg, "now") == 0) {
                return time(0);
        }
+       if (arg[0] == '@') {
+               /* interpret it as an integer */
+               ret = strtoul(arg+1, &tmp, 0);
+               if (*tmp)
+                       return ((time_t) -1);
+               return ret;
+       }
        memset(&ts, 0, sizeof(ts));
 #ifdef HAVE_STRPTIME
        strptime(arg, "%Y%m%d%H%M%S", &ts);