From: Theodore Ts'o Date: Tue, 12 Jun 2012 02:02:17 +0000 (-0400) Subject: debugfs: interpret date strings of the form @dddd X-Git-Tag: v1.42.4~6 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=6854ab1d4a1f9fb3599f027d2593d9c4d64b5e32;p=tools%2Fe2fsprogs.git 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" --- 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);