}
}
+static void print_time(time_t t)
+{
+ const char * time_str;
+ static int do_gmt = -1;
+
+#ifdef __dietlibc__
+ /* The diet libc doesn't respect the TZ environemnt variable */
+ if (do_gmt == -1) {
+ time_str = getenv("TZ");
+ if (!time_str)
+ time_str = "";
+ do_gmt = !strcmp(time_str, "GMT0");
+ }
+#endif
+ time_str = asctime((do_gmt > 0) ? gmtime(&t) : localtime(&t));
+ printf("%.24s", time_str);
+}
+
/*
* This function handles the '@' expansion. We allow recursive
* expansion; an @ expression can contain further '@' and '%'
{
struct ext2_inode *inode;
struct ext2_inode_large *large_inode;
- const char * time_str;
time_t t;
- static int do_gmt = -1;
if (!ctx || !ctx->inode)
goto no_inode;
printf("0%o", inode->i_mode);
break;
case 'M':
-#ifdef __dietlibc__
- /* The diet libc doesn't respect the TZ environemnt variable */
- if (do_gmt == -1) {
- time_str = getenv("TZ");
- if (!time_str)
- time_str = "";
- do_gmt = !strcmp(time_str, "GMT0");
- }
-#endif
- t = inode->i_mtime;
- time_str = asctime((do_gmt > 0) ? gmtime(&t) : localtime(&t));
- printf("%.24s", time_str);
+ print_time(inode->i_mtime);
break;
case 'F':
printf("%u", inode->i_faddr);
static _INLINE_ void expand_percent_expression(ext2_filsys fs, char ch,
struct problem_context *ctx)
{
+ e2fsck_t e2fsck_ctx = fs ? (e2fsck_t) fs->priv_data : NULL;
+
if (!ctx)
goto no_context;
case 's':
printf("%s", ctx->str ? ctx->str : "NULL");
break;
+ case 't':
+ print_time((time_t) ctx->num);
+ break;
+ case 'T':
+ print_time(e2fsck_ctx ? e2fsck_ctx->now : time(0));
+ break;
case 'X':
#ifdef EXT2_NO_64_TYPE
printf("0x%x", ctx->num);
/* Last mount time is in the future */
{ PR_0_FUTURE_SB_LAST_MOUNT,
- N_("@S last mount time is in the future. "),
+ N_("@S last mount time (%t,\n\tnow = %T) is in the future.\n"),
PROMPT_FIX, PR_NO_OK },
/* Last write time is in the future */
{ PR_0_FUTURE_SB_LAST_WRITE,
- N_("@S last write time is in the future. "),
+ N_("@S last write time (%t,\n\tnow = %T) is in the future.\n"),
PROMPT_FIX, PR_NO_OK },
{ PR_0_EXTERNAL_JOURNAL_HINT,
}
if (fs->super->s_wtime > (__u32) ctx->now) {
pctx.num = fs->super->s_wtime;
- problem = PR_0_FUTURE_SB_LAST_MOUNT;
+ problem = PR_0_FUTURE_SB_LAST_WRITE;
if (fs->super->s_wtime <= (__u32) ctx->now + ctx->time_fudge)
problem = PR_0_FUTURE_SB_LAST_MOUNT_FUDGED;
if (fix_problem(ctx, problem, &pctx)) {