Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] Timer For -- Ville (was: RE:Outline...)

Expand Messages
  • hsavage
    ... -Ville, wheeler, Thanks to Eb the math for the calculation is in the clip above. The times used must be in 24 hour clock mode(which is fine) but it has a
    Message 1 of 1 , Apr 6, 2002
    • 0 Attachment
      > On 4/4/02 1:53 PM, wheeler54321 wrote:
      >
      > Now before I try this myself, does anyone know if there's a command
      > (or clip) for
      > substracting times (/dates) to count the duration of some event,
      >
      > eg.
      >
      > "14:45 minus 10:30 equals to 4:15 (or to 4.25)"?
      >
      > -Ville
      >
      > Hi!
      >
      > All the credits go to Eb Guenther - the original thread:
      > http://groups.yahoo.com/group/ntb-clips/message/6068
      >
      > Watch out for long lines
      >
      > ;_____________________________________
      > ^!SetListDelimiter ":"
      > ^!SetArray %ST%=^?{Starting Time (hh:nn:ss)};%ET%=^?{Ending Time
      > (hh:nn:ss)}
      >
      > ;____________ convert to seconds
      > ^!Set %Ssec%=^$Calc(^%ST3% + ^%ST2% * 60 + ^%ST1% * 3600)$
      > ^!Set %Esec%=^$Calc(^%ET3% + ^%ET2% * 60 + ^%ET1% * 3600)$
      > ;____________ midnight correction
      > ^!If ^%Ssec%>^%Esec% ^!Inc %Esec% 86400
      > ;____________ elapsed time in seconds
      > ^!Set %secs%=^$Calc(^%Esec%-^%Ssec%)$
      > ;____________ convert to hh:mm:ss, left zero fill
      > ^!Set %hrs%=^$StrCopyRight("0^$Calc( ^%secs% DIV 3600)$";2)$
      > ^!Set %min%=^$StrCopyRight("0^$Calc((^%secs%-3600*^%secs%DIV3600)
      > div60)$";2)$
      > ^!Set %sec%=^$StrCopyRight("0^$Calc( ^%secs% MOD 60)$";2)$
      >
      > ^!Info [L]End %Start Time:^t^%ST%^%NL%^%NL%End Time:^%NL%^%ET%^%NL%^%
      > NL%Elapsed Time:^%NL%^%hrs%:^%min%:^%sec%
      > _______
      > wheeler

      -Ville, wheeler,

      Thanks to Eb the math for the calculation is in the clip above. The
      times used must be in 24 hour clock mode(which is fine) but it has a 24
      hour limit.

      I modified it slightly to accomodate multiple days, if anyone has that
      need.

      Multiple days includes any time span greater that 24 hours, eg.

      Starting Time = sometime today(Saturday)
      Ending Time = sometime day after tomorrow(Monday)

      Days Between = 1 (Enter the digit '1' in the appropriate wizard.)

      LONG LINE, There were several long lines -wrapped in the wrong place- in
      the original clip. The method below eliminates the worry about lines
      being wrapped in the wrong places.

      H="ECW_RESTORE"
      ; ***IMPORTANT***
      ; SIMPLEST METHOD
      ;
      ; COPY BOTH THESE
      ; CLIPS TO A BLANK DOC.
      ;
      ; CUT FIRST CLIP TO THE CLIPBOARD,
      ; ADD/PASTE INTO ANY CLIPBOOK!
      ;
      ; SELECT THE REMAINING TEXT AND
      ; RUN THIS CLIP ON IT TO DE-FORMAT!
      ; THEN, PASTE THE RESULTING CLIP
      ; INTO A CLIPBOOK.
      ;
      ^!Clearvariables
      ^!SetWordwrap 0
      ^!SetScreenUpdate 0
      ^!ToolBar E-Mail UnQuote
      ^!Replace "^p" >> "" TIwHSA
      ^!Replace "ºtº" >> "^t" TIwHSA
      ^!Replace "ºsº" >> " " TIwHSA
      ^!Replace "ºrº" >> "^p" TIwHSA
      ^!Replace "ºcº" >> "^" TIwHSA


      H="Elapsedºsº---------------ºsºTime"ºrººcº!SetWiza
      rdLabelºsºCOVERSºsºAºsº24ºsºHOURºsºSPANºsºONLY!ºrº
      ºcº!SetListDelimiterºsº":"ºrººcº!SetArrayºsº%ST%=º
      cº?{STARTINGºsºTIMEºsºINºsº24ºsºHOURºsºFORMATºsº(h
      h:nn:ss)=22:30:25};ºsº%ET%=ºcº?{ENDINGºsºTIMEºsºIN
      ºsº24ºsºHOURºsºFORMATºsº(hh:nn:ss)=13:35:30};ºsº%d
      ays%=ºcº?{NUMBERºsºOFºsºDAYSºsºIFºsºOVERºsº24ºsºHO
      URS=0}ºrº;____________ºsºconvertºsºtoºsºsecondsºrº
      ºcº!Setºsº%Ssec%=ºcº$Calc(ºcº%ST3%ºsº+ºsººcº%ST2%º
      sº*ºsº60ºsº+ºsººcº%ST1%ºsº*ºsº3600)$ºrººcº!Setºsº%
      Esec%=ºcº$Calc(ºcº%ET3%ºsº+ºsººcº%ET2%ºsº*ºsº60ºsº
      +ºsººcº%ET1%ºsº*ºsº3600)$ºrº;____________ºsºmidnig
      htºsºcorrectionºrººcº!Ifºsººcº%Ssec%>ºcº%Esec%ºsºº
      cº!Incºsº%Esec%ºsº86400ºrº;____________ºsºelapsedº
      sºtimeºsºinºsºsecondsºrººcº!Setºsº%secs%=ºcº$Calc(
      ºcº%Esec%-ºcº%Ssec%)$ºrº;____________ºsºconvertºsº
      toºsºhh:mm:ss,ºsºleftºsºzeroºsºfillºrººcº!Setºsº%h
      rs%=ºcº$StrCopyRight("0ºcº$Calc(ºcº%secs%ºsºDIVºsº
      3600)$";2)$ºrº;____________ºsºcorrectºsºforºsºmult
      ipleºsºdaysºrººcº!Ifºsººcº%days%ºsº>ºsº0ºsººcº!Set
      ºsº%hrs%=ºcº$Calc(ºcº%hrs%+(ºcº%days%*24))$ºrººcº!
      Setºsº%min%=ºcº$StrCopyRight("0ºcº$Calc((ºcº%secs%
      -3600*ºcº%secs%DIV3600)div60)$";2)$ºrººcº!Setºsº%s
      ec%=ºcº$StrCopyRight("0ºcº$Calc(ºsººcº%secs%ºsºMOD
      ºsº60)$";2)$ºrººcº!Infoºsº[L]ºsºStartºsºTime:ºcº%S
      T%ºcº%NL%ºcº%NL%ºsºDaysºsºbetweenºsºtimes:ºcº%days
      %ºcº%NL%ºcº%NL%ºsºEndºsºTime:ºcº%ET%ºcº%NL%ºcº%NL%
      ElapsedºsºTime:ºcº%hrs%:ºcº%min%:ºcº%sec%ºrººrººrº
    Your message has been successfully submitted and would be delivered to recipients shortly.