Date: Wed, 26 Aug 2020 00:21:42 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 248918] date(1) -f uses current time for unspecified components Message-ID: <bug-248918-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248918 Bug ID: 248918 Summary: date(1) -f uses current time for unspecified components Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: emaste@freebsd.org Date's -j and -f flags can be used together to specify a date, in an arbitrary format, to convert it to a different format. The man page gives % date -j -f "%a %b %d %T %Z %Y" "`date`" "+%s" as an example to convert a string in date's usual output format to an epoch timestamp. If the -j and -f flags are used without specifying all components of struct tm the unspecified components keep their current values: % date -j -f %Y-%m-%d 2021-09-30 +%s; sleep 5; date -j -f %Y-%m-%d 2021-09-30 +%s 1633047180 1633047185 This is behaviour is surprising; it's useful for -f alone (the user might want to change the time but leave the date alone, for example), but seems like -j should start with all components zeroed. -- You are receiving this mail because: You are the assignee for the bug.help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-248918-227>
