From: ab411@detroit.freenet.org (David R. Conrad)
To: cypherpunks@toad.com
Message Hash: 18409bdd4ae9cb4ee0eba1993449d23f43a80f614a21fa72ae4320795cc2f3cc
Message ID: <199508290435.AAA11757@detroit.freenet.org>
Reply To: N/A
UTC Datetime: 1995-08-29 18:42:31 UTC
Raw Date: Tue, 29 Aug 95 11:42:31 PDT
From: ab411@detroit.freenet.org (David R. Conrad)
Date: Tue, 29 Aug 95 11:42:31 PDT
To: cypherpunks@toad.com
Subject: Re: SSL trouble
Message-ID: <199508290435.AAA11757@detroit.freenet.org>
MIME-Version: 1.0
Content-Type: text/plain
-----BEGIN PGP SIGNED MESSAGE-----
"Daniel R. Oelke" <droelke@rdxsunhost.aud.alcatel.com> writes:
>someone, probably either patrick@Verity.COM or hallam@w3.org, writes:
>>Piete.Brooks@cl.cam.ac.uk, stripes@va.pubnix.com writes:
>>
>>> I'd like to get the raw date in brloop (a sh script). In perl I'd just
>>> use "time", and I can't see a way to get "date +" to yield the raw time.
>>> I could use "date=`perl -e 'print time'`" but that seems OTT, and perl
>>> may not be on teh users PATH. Any suggestions ?
>>
>>"date '+%s'" does it under BSDI, but I'm not sure how portable it is.
>>
>
>That doesn't work under SunOS 4.1.x, but this does:
>
> date "+%S %M 60 * + %H 3600 * + %j 86400 * + %y 31536000 * + p" | dc
>
>This assumes 365 days/year, so if you jump from a leap year to a non-leap
>year it won't work right. Hey - a 1/1460 failure rate is better
>than most Windoze programs I've used ;-)
>
>It also isn't the "absolute" time, (as given by time()), but
>gives a number of seconds that constantly increases.
>
>With a little more work you should be able to adjust this to be close
>to time() functionality.
This was, of course, originally one long line:
date +"%S %M 60 * + %H 3600 * + %j 1 - 86400 * + %y 70 - 31536000 * + %y
69 - 4 / 86400 * + 3600 4 * + p" |dc
Differences: %j 1 -, because days of the year are numbered from 1, not
zero, and we don't want to count 86400 seconds for today before today
has finished.
%y 70 -, because 1970 is the epoch, of course.
%y 69 - 4 / 86400 * +, takes into account all leap days in all leap years
up through last year. Why? Left as an exercise for the reader. ;-)
3600 4 * +, this is a bit of ugliness. date +%s returns GMT for me.
I'm in EDT, so that's four hours away from GMT. So this is necessary to
make this return the same number as date +%s. But if you're in another
time zone, you need to change that 4 above appropriately. If this whole
section is deleted we are left with:
date +"%S %M 60 * + %H 3600 * + %j 1 - 86400 * + %y 70 - 31536000 * + %y
69 - 4 / 86400 * + p" |dc
which returns local time, which is probably what you wanted anyway.
By the way, date --version, on my system, returns "GNU shellutils 1.9.4",
just in case you were wondering what date I'm using.
-----BEGIN PGP SIGNATURE-----
Version: 2.6.2
iQCVAwUBMEKT+REcrOJethBVAQEXgAQAx9HLiR+LPvclEYRFrliqOugj9cbzGwLD
HCWOC8/MfrXuS3MPLQj1HugA18LH/LGy3BTp7cSnSNXDoL2/7UkLeAspGejRrEG4
WgQ8HIC2weVDP66PqioFD6lAELatRWk4Xl/mLgVrxluBrKtRnADtCX/VdHPw1ZiU
YDfiWBtKRGU=
=i1Di
-----END PGP SIGNATURE-----
--
David R. Conrad, ab411@detroit.freenet.org, http://www.grfn.org/~conrad
Finger conrad@grfn.org for PGP 2.6 public key; it's also on my home page
Key fingerprint = 33 12 BC 77 48 81 99 A5 D8 9C 43 16 3C 37 0B 50
Jerry Garcia, August 1, 1942 - August 9, 1995. Requiescat in pace.
Return to August 1995
Return to “ab411@detroit.freenet.org (David R. Conrad)”
1995-08-29 (Tue, 29 Aug 95 11:42:31 PDT) - Re: SSL trouble - ab411@detroit.freenet.org (David R. Conrad)