instead of localtime() or ctime() to force the use of GMT.
This is because the dietlibc doesn't honor the TZ environment
variable.
2004-11-30 Theodore Ts'o <tytso@mit.edu>
+ * util.c (time_to_string): If the TZ environment variable is set
+ to GMT, use gmtime() instead of localtime() or ctime() to
+ force the use of GMT. This is because the dietlibc
+ doesn't honor the TZ environment variable.
+
* Makefile.in: Use Linux-kernel-style makefile output to make it
easier to see errors/warnings.
char *time_to_string(__u32 cl)
{
time_t t = (time_t) cl;
+ static int do_gmt = -1;
- return ctime(&t);
+ if (do_gmt == -1) {
+ /* The diet libc doesn't respect the TZ environemnt variable */
+ do_gmt = !strcmp(getenv("TZ"), "GMT");
+ }
+
+ return asctime((do_gmt) ? gmtime(&t) : localtime(&t));
}
/*
2004-11-30 Theodore Ts'o <tytso@mit.edu>
+ * message.c (expand_inode_expression): If the TZ environment
+ variable is set to GMT, use gmtime() instead of
+ localtime() or ctime() to force the use of GMT. This is
+ because the dietlibc doesn't honor the TZ environment
+ variable.
+
* e2fsck.h: Add io_options to e2fsck_struct
* unix.c: If there is a question mark in the device name, separate
/*
* This function expands '%IX' expressions
*/
-static _INLINE_ void expand_inode_expression(char ch,
- struct problem_context *ctx)
+static _INLINE_ void expand_inode_expression(char ch,
+ struct problem_context *ctx)
{
struct ext2_inode *inode;
char * time_str;
time_t t;
+ int do_gmt = -1;
if (!ctx || !ctx->inode)
goto no_inode;
printf("0%o", inode->i_mode);
break;
case 'M':
+ /* The diet libc doesn't respect the TZ environemnt variable */
+ if (do_gmt == -1) {
+ do_gmt = !strcmp(getenv("TZ"), "GMT");
+ }
t = inode->i_mtime;
- time_str = ctime(&t);
+ time_str = asctime(do_gmt ? gmtime(&t) : localtime(&t));
printf("%.24s", time_str);
break;
case 'F':