From 6854ab1d4a1f9fb3599f027d2593d9c4d64b5e32 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 11 Jun 2012 22:02:17 -0400 Subject: [PATCH] debugfs: interpret date strings of the form @dddd 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" --- debugfs/util.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debugfs/util.c b/debugfs/util.c index b07a8cc..cf3a6c6 100644 --- a/debugfs/util.c +++ b/debugfs/util.c @@ -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); -- 1.8.3.1