[comp.unix.questions] How to get seconds-since-epoch in shell script

mjd@central.cis.upenn.edu (Mark-Jason Dominus) (09/27/90)

I want to be able to get the the time in seconds-since-epoch
form, and I was surprised to learn that none of the `date'
commands we have near here had a seconds-since-epoch format,
since it would have been so easy to include.

Is there a way to get that time that is easier than
computing it from the second, minute, hour, julian-date, and
year?
--

 In some sense a stochastic process can do better; at least it has a chance.
Mark-Jason Dominus 	  			    mjd@central.cis.upenn.edu 

merlyn@iwarp.intel.com (Randal Schwartz) (09/28/90)

In article <MJD.90Sep27110855@central.cis.upenn.edu>, mjd@central (Mark-Jason Dominus) writes:
| I want to be able to get the the time in seconds-since-epoch
| form, and I was surprised to learn that none of the `date'
| commands we have near here had a seconds-since-epoch format,
| since it would have been so easy to include.
| 
| Is there a way to get that time that is easier than
| computing it from the second, minute, hour, julian-date, and
| year?

perl -e 'print time;'

Looks pretty easy to me.  If you were willing to fork a 'date',
forking a 'perl' is about as tough.

[What, you're not running Perl yet?  Complain to your sysadm...]

print "Just another Perl hacker,"
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Welcome to Portland, Oregon, home of the California Raisins!"=/