Allow 0 timestamp

This commit is contained in:
christos 2017-02-16 22:42:25 +00:00
parent f8bc8f05cf
commit 285cf56905
3 changed files with 8 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkfs_msdos.c,v 1.11 2017/02/16 18:49:31 christos Exp $ */
/* $NetBSD: mkfs_msdos.c,v 1.12 2017/02/16 22:42:25 christos Exp $ */
/*
* Copyright (c) 1998 Robert Nordier
@ -37,7 +37,7 @@
static const char rcsid[] =
"$FreeBSD: src/sbin/newfs_msdos/newfs_msdos.c,v 1.15 2000/10/10 01:49:37 wollman Exp $";
#else
__RCSID("$NetBSD: mkfs_msdos.c,v 1.11 2017/02/16 18:49:31 christos Exp $");
__RCSID("$NetBSD: mkfs_msdos.c,v 1.12 2017/02/16 22:42:25 christos Exp $");
#endif
#endif /* not lint */
@ -621,7 +621,7 @@ mkfs_msdos(const char *fname, const char *dtype, const struct msdos_options *op)
printf("MBR type: %d\n", ch);
print_bpb(&bpb);
if (!o.no_create) {
if (o.timestamp) {
if (o.timestamp_set) {
tv.tv_sec = now = o.timestamp;
tv.tv_usec = 0;
tm = gmtime(&now);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkfs_msdos.h,v 1.4 2017/02/16 18:49:31 christos Exp $ */
/* $NetBSD: mkfs_msdos.h,v 1.5 2017/02/16 22:42:25 christos Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@ -61,6 +61,7 @@ struct msdos_options {
ALLOPTS
#undef AOPT
time_t timestamp;
uint32_t timestamp_set:1;
uint32_t volume_id_set:1;
uint32_t media_descriptor_set:1;
uint32_t hidden_sectors_set:1;

View File

@ -1,4 +1,4 @@
/* $NetBSD: newfs_msdos.c,v 1.44 2017/02/16 18:49:31 christos Exp $ */
/* $NetBSD: newfs_msdos.c,v 1.45 2017/02/16 22:42:25 christos Exp $ */
/*
* Copyright (c) 1998 Robert Nordier
@ -33,7 +33,7 @@
static const char rcsid[] =
"$FreeBSD: src/sbin/newfs_msdos/newfs_msdos.c,v 1.15 2000/10/10 01:49:37 wollman Exp $";
#else
__RCSID("$NetBSD: newfs_msdos.c,v 1.44 2017/02/16 18:49:31 christos Exp $");
__RCSID("$NetBSD: newfs_msdos.c,v 1.45 2017/02/16 22:42:25 christos Exp $");
#endif
#endif /* not lint */
@ -170,6 +170,7 @@ main(int argc, char *argv[])
o.size = argto4(optarg, 1, "file system size");
break;
case 'T':
o.timestamp_set = 1;
o.timestamp = get_tstamp(optarg);
break;
case 'u':