Feature #5642
closed
want BSD-like date -r option
Added by Alexander Pyhalov over 7 years ago.
Updated almost 3 years ago.
Category:
cmd - userland programs
Description
In FreeBSD date there's "-r" option to convert seconds since the Epoch to current date. It would be nice to have this option in illumos date.
GNU coreutils (as used by most Linux distributions) uses -r for:
-r, --reference=FILE
display the last modification time of FILE
$ date -r /etc/hosts
Tue Jan 6 18:21:09 PST 2015
The behavior you mention is available under Linux with the syntax:
$ date --date='@1444666647'
Mon Oct 12 09:17:27 PDT 2015
No opinion on adding this to illumos, just pointing out however it's done it will be incompatible with another common OS.
Mac OS X, at least in Yosemite (10.10.2), includes a FreeBSD-compatible -r flag.
$ uname -a
Darwin leftbook.local 14.1.0 Darwin Kernel Version 14.1.0: Mon Dec 22 23:10:38 PST 2014; root:xnu-2782.10.72~2/RELEASE_X86_64 x86_64
$ date -r 0
Wed 31 Dec 1969 16:00:00 PST
$ date -r 1000000000
Sat 8 Sep 2001 18:46:40 PDT
- Category set to cmd - userland programs
- Status changed from New to Closed
- Assignee set to Robert Mustacchi
- Tags deleted (
needs-triage)
This was implemented in 8893 in a way that basically provides support for both variants as per other systems.
Also available in: Atom
PDF