North American Network Operators Group

Date Prev | Date Next | Date Index | Thread Index | Author Index | Historical

Re: Unix Timestamp

  • From: Henry Yen
  • Date: Tue Oct 23 03:00:01 2001

On Mon, Oct 22, 2001 at 08:45:25AM -0400, Greg A. Woods wrote:
> [ On Monday, October 22, 2001 at 18:18:41 (-0500), Chris Adams wrote: ]
> > On Red Hat Linux 7.1:
> > $ date -r 1003723200
> > date: 1003723200: No such file or directory
> 
> The first two were kinda sad examples of the state of commercial Unix
> (unfortunately even SuSv2 lacks this now ancient feature!), but this

sounds like a BSD-ism (for purists?); NetBSD 1.5.2 has the "-r" option,
and it works as expected.  Linux 6.2 and up switched to sh-utils-2.0,
which uses "-r" as "refer to date of file", so there's now a clear
divergence.

> last one (i.e. GNU date) surprises the heck out of me -- especially
> since there's not even an equivalent option with a different name....

yes, especially, as you can go forward:
   bash$ date "+%s"
   1003819816

however, a quick reading of the doc indicated that one can do:
   bash$ date --date="01/01/1970 UTC 1003819816 seconds"
   Tue Oct 23 02:50:16 EDT 2001
unfortunately, the timezone (EDT here) doesn't work right, except on a
old slackware box (which is probably a bug, either way).

-- 
Henry Yen                                       Aegis Information Systems, Inc.
Senior Systems Programmer                       Hicksville, New York