'TIMER - calc's time before start and duration in seconds

external  fentrybox() messboxwait()

public    ptstr

global    x $st $et $it $daysec tts

MAIN
single-step off
  while true
    x = fentrybox(" Enter number of days ahead ",2,"#{#}","0")
    if x = -1
      continue while
    end if
    $daysec=val(ptstr)*24*60*60
' message "$daysec is:"&str($daysec)
    exit while
  end while


  while true
    x = fentrybox(" Enter Start time ",6,"##\:##",time)
    if x = -1
      continue while
    end if
    $st=(3600*val(left(ptstr,2)))+(60*val(right(ptstr,2)))
' message "$st is:"&str($st)
    exit while
  end while

'enter End time
  while true
    x = fentrybox(" Enter End time ",6,"##\:##",time)
    if x = -1
      continue while
    end if
    $et=(3600*val(left(ptstr,2)))+(60*val(right(ptstr,2)))
' message "$et is:"&str($et)
    exit while
  end while

'enter Intial time
  while true
    x = fentrybox(" Enter Initial time ",6,"##\:##",time)
    if x = -1
      continue while
    end if
    $it=(3600*val(left(ptstr,2)))+(60*val(right(ptstr,2)))
' message "$it is:"&str($it)
    exit while
  end while

  if $st<$it
    tts=$st-$it+86400
  else
    tts=$st-$it+$daysec
  end if
  messboxwait(" Start Time is"&str(tts)&"secs and runs for"&str($et-$st)&"secs ",0,0,1)

END MAIN
