Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Average of times

From: greggirwin:mindspring at: 3-May-2004 15:44

Hi Stuart, M> I have a series of times which represents session durations of users. M> They are in the format dd:hh:mm M> What I want to figure out is how long the average session takes. This is a good example of something that could be done many different ways in REBOL (like a lot of things :). Here's what came into my head. make-dhm-time: func [time /local ms] [ ms: time // 24:00 to time! reduce [to integer! time / 24:00 ms/hour ms/minute] ] avg-dhm-times: func [block /local result] [ result: 0:0:0 foreach t block [ result: add result to time! reduce [ t/hour * 24 + t/minute to integer! t/second ] ] make-dhm-time result / length? block ] -- Gregg