timer

timer

Post by Scott Onofr » Wed, 07 Feb 1996 04:00:00



I want a function called time.

This function returns the number of non-leap seconds since e.g.
January 1, 1970 UTC.

For example

TIME= time ();

echo $TIME  ---> 9878684843

... 2 seconds later

TIME= time ();

echo $TIME  ---> 9878684845

Any body have such a function. This is standard in PERL.

Email with any help,
--

Scott Onofrio
________________________________________ Hewlett-Packard (M/S AU100)

Phone: 970-679-3105                      815 Southwest 14th Street
Fax:   970-679-5961                      Loveland, Colorado 80537

 
 
 

timer

Post by Dale DePrie » Thu, 08 Feb 1996 04:00:00


|> I want a function called time.
|>
|> This function returns the number of non-leap seconds since e.g.
|> January 1, 1970 UTC.
|>
|>
|> For example
|>
|> TIME= time ();
|>
|> echo $TIME  ---> 9878684843
|>
|> ... 2 seconds later
|>
|> TIME= time ();
|>
|> echo $TIME  ---> 9878684845
|>
|> Any body have such a function. This is standard in PERL.
|>
|>
|> Email with any help,
|> --
|>
|> Scott Onofrio
|> ________________________________________ Hewlett-Packard (M/S AU100)

|> Phone: 970-679-3105                      815 Southwest 14th Street
|> Fax:   970-679-5961                      Loveland, Colorado 80537

Well I don't have the answer off the top of my head but the function
would be pretty easy in ksh.  The variable SECONDS is maintained by the
shell so you mearly set it with a seed value and then reference it
later.

For example: one such seed value might be SECONDS=`date '+(%H*60+%M)*60+%S'`
You only need to modify this slightly to add a few more fields.

Hope this helps.
--
    _      _     Dale DePriest                  San Jose, California

 o/_/ (_(_X_(`                                  fax: (408) 894-3457