From ankh.iia.org!babbage.ece.uc.edu!news.kei.com!eff!news.duke.edu!convex!cs.utexas.edu!howland.reston.ans.net!pipex!lyra.csx.cam.ac.uk!doc.ic.ac.uk!uknet!comlab.ox.ac.uk!imc Sat Aug 20 10:36:09 1994
Newsgroups: comp.lang.rexx
Path: ankh.iia.org!babbage.ece.uc.edu!news.kei.com!eff!news.duke.edu!convex!cs.utexas.edu!howland.reston.ans.net!pipex!lyra.csx.cam.ac.uk!doc.ic.ac.uk!uknet!comlab.ox.ac.uk!imc
From: imc@comlab.ox.ac.uk (Ian Collier)
Subject: Re: TIME() function
Message-ID: <5042.imc@uk.ac.ox.prg>
X-Local-Date: Thursday, 18th August 1994 at 4:44pm BST
Originator: imc@client21.comlab
Organization: Oxford University Computing Laboratory
References: <e6f_9408121730@blkcat.fidonet.org>
Date: Thu, 18 Aug 1994 15:44:16 GMT
Lines: 35

In article <e6f_9408121730@blkcat.fidonet.org>, James.L..Sutherland@f347.n109.z1.fidonet.org (James L. Sutherland) wrote:

> /*  The following REXX routine will return time since midnight, down to */ 
>/* tenths of seconds.  Format is nnnnn.n */

>/*:get_time */
>get_time:
>   mtime = time('S') /* current time to 1000's of seconds */
>   ltime = time('L') /* seconds since midnight */
>   if (substr(mtime,5,1) <> substr(ltime,8,1)) then
>      mtime = mtime + 1  /* adjust for difference in seconds */
>   tsec =substr(ltime,10,1) /* get tenths */
>   ctime = mtime + (tsec / 10) /* add tenths */
>return ctime /* return seconds.tenths since midnight */

You have the comments swapped on the first two lines.  In any case, you can
do better than this by using REXX's timestamp feature:

   parse value time('S') time('L') with seconds . '.' +0 fraction
   return format(seconds || fraction,,1)

REXX's timestamp feature says that the two calls to time() in the first
line above are guaranteed to return consistent values - in other words,
the value for time('L') is calculated as if you had called it at the exact
same instant as in the time('S').

The first line splits the time into an integer value (from time('S')) and a
fractional value (everything after the dot from time('L'), including the dot
itself).  The second line concatenates the integer and fractional parts and
formats them in the required way.  This rounds up or down to the nearest
tenth, but a different format can easily be returned by changing this
instruction.

Ian Collier
Ian.Collier@comlab.ox.ac.uk | imc@ecs.ox.ac.uk

From ankh.iia.org!babbage.ece.uc.edu!news.kei.com!MathWorks.Com!news.duke.edu!convex!uunet!blkcat!org!fidonet!z1!n109!f347!James.L..Sutherland Sat Aug 20 10:36:42 1994
Path: ankh.iia.org!babbage.ece.uc.edu!news.kei.com!MathWorks.Com!news.duke.edu!convex!uunet!blkcat!org!fidonet!z1!n109!f347!James.L..Sutherland
From: James.L..Sutherland@f347.n109.z1.fidonet.org (James L. Sutherland)
Date: 19 Aug 94 11:29:04 -0500
Newsgroups: comp.lang.rexx
Subject: TIME() function
Message-ID: <545_9408191634@blkcat.fidonet.org>
X-Mail-Agent: GIGO+ sn 28 at blkcat vsn 0.99 pl1
X-FTN-To: imc@comlab.ox.ac.uk
Organization: Fidonet: OS/2 Shareware BBS, Fairfax, VA: 703-385-4325 
Lines: 26

On 08-18-1994, imc@comlab.ox.ac.uk said to All

i> You have the comments swapped on the first two lines.

  Woops!

i> .  In any case, you can
i> do better than this by using REXX's timestamp feature:

   I knew about this.  There was some reason I didn't use it.  That reason
escapes me at the moment <g>.  In any case, I went in and simplified it to
this:

/*:get_time */
get_time:
return (time('S') || substr(time('L'),9,3)) /* return seconds.hundreths since
midnight */
 
Internet: J.SUTHERLA10@GENIE.GEIS.COM

___
 X KWQ/2 1.2e X I'm an OS/2 developer...I don't NEED a life!
---------
Fidonet:  James L. Sutherland 1:109/347
Internet: James.L..Sutherland@f347.n109.z1.fidonet.org


