[43690] in North American Network Operators' Group

home help back first fref pref prev next nref lref last post

Re: Unix Timestamp

daemon@ATHENA.MIT.EDU (Henry Yen)
Tue Oct 23 02:57:58 2001

Message-ID: <20011023025719.Z21694@nntp.AegisInfoSys.com>
Date: Tue, 23 Oct 2001 02:57:19 -0400
From: Henry Yen <henry@AegisInfoSys.com>
To: North America Network Operators Group Mailing List <nanog@merit.edu>
Mail-Followup-To: North America Network Operators Group Mailing List <nanog@merit.edu>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
In-Reply-To: <20011023004525.A08B2E8@proven.weird.com>; from Greg A. Woods on Mon, Oct 22, 2001 at 08:45:25AM -0400
Errors-To: owner-nanog-outgoing@merit.edu


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

home help back first fref pref prev next nref lref last post