Can you be sure a day will always have 86400 seconds?  I'm asking because
there was an extra second on the last day of last year.  This probably
doesn't effect timers that aren't synched to NIST, but it's possible.  When
I calculate a day fraction, I add five seconds to the denominator to
increase the likelihood that the quotient will always be less than one.  If
you do this consistently, it's workable.

On Sat, Jan 3, 2009 at 4:56 PM, David Vincent-Jones <
[email protected]> wrote:

> Tom;
>
> Very nice .. very clean
>
> Thank you;
>
> David
>
> On Sat, 2009-01-03 at 15:09 -0600, Tom Arneson wrote:
> > I'd use the todayno verb from dates.ijs to convert the Y M D columns
> >
> > NB. Start J code
> > NB. ------------------------
> >
> > require 'dates'
> >
> > NB. sample data
> > d=: 0". [;._2 (0 : 0)
> > 2008 12 01 00 46 16
> > 2008 12 01 01 46 19
> > 2008 12 01 03 49 52
> > 2008 12 01 04 49 56
> > 2008 12 01 09 05 33
> > )
> >
> > NB. convert to days and decimals of days
> > t=.(todayno 3{."1 d) + 86400%~0 60 60#._3{."1 d
> >
> > NB. convert to interval in minutes
> > ti=: }:_1440*t-1|.t
> >
> >    ti
> > 60.05 123.55 60.0667 255.617
> >
> > NB. End J code
> >
> > -----Original Message-----
> > From: [email protected]
> > [mailto:[email protected]] On Behalf Of David
> Vincent-Jones
> > Sent: Saturday, January 03, 2009 13:55
> > To: JSoftware
> > Subject: [Jprogramming] Time Intervals
> >
> > I have a series of time-stamps taken from a pump station where I need to
> > evaluate the operating intervals in minutes.
> >
> > The stamps run over day ends, month and even years so I am looking for a
> > simple way to count time from a fixed date .. even a recent date such as
> > '2008 01 01 00 00.00' would be fine.
> >
> > data example:
> > 2008 12 01 00 46 16
> > 2008 12 01 01 46 19
> > 2008 12 01 03 49 52
> > 2008 12 01 04 49 56
> > 2008 12 01 09 05 33
> >
> > I have been doing this the hard way with lots of 'intervention' but
> > probably somebody has already solved this elegantly and ideas would be
> > appreciated.
> >
> > David
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to