-- | Time Reading
module CsoundExpr.Opcodes.Control.Timeread
    (readclock,
     rtclockI,
     rtclockK,
     timeinstk,
     timeinsts,
     timesI,
     timesK,
     timekI,
     timekK,
     date,
     dates)
where



import CsoundExpr.Base.Types
import CsoundExpr.Base.MultiOut
import CsoundExpr.Base.SideEffect
import CsoundExpr.Base.UserDefined



-- | * opcode : readclock
--  
--  
-- * syntax : 
--  
--  >   ir readclock inum
--  
--  
-- * description : 
--  
--  Reads the value of an internal clock.
--  
--  
-- * url : <http://www.csounds.com/manual/html/readclock.html>
 
readclock :: Irate -> Irate
readclock i0num = opcode "readclock" args
  where args = [to i0num]


-- | * opcode : rtclock
--  
--  
-- * syntax : 
--  
--  >   ires rtclock
--  >   kres rtclock
--  
--  
-- * description : 
--  
--  Read the real-time clock from the operating system.
--  
--  
-- * url : <http://www.csounds.com/manual/html/rtclock.html>
 
rtclockI :: Irate
rtclockI = opcode "rtclock" args
  where args = []


-- | * opcode : rtclock
--  
--  
-- * syntax : 
--  
--  >   ires rtclock
--  >   kres rtclock
--  
--  
-- * description : 
--  
--  Read the real-time clock from the operating system.
--  
--  
-- * url : <http://www.csounds.com/manual/html/rtclock.html>
 
rtclockK :: Krate
rtclockK = opcode "rtclock" args
  where args = []


-- | * opcode : timeinstk
--  
--  
-- * syntax : 
--  
--  >   kres timeinstk
--  
--  
-- * description : 
--  
--  Read absolute time, in k-rate cycles, since the start of an
-- instance of an instrument. Called at both i-time as well as
-- k-time.
--  
--  
-- * url : <http://www.csounds.com/manual/html/timeinstk.html>
 
timeinstk :: Krate
timeinstk = opcode "timeinstk" args
  where args = []


-- | * opcode : timeinsts
--  
--  
-- * syntax : 
--  
--  >   kres timeinsts
--  
--  
-- * description : 
--  
--  Read absolute time, in seconds, since the start of an instance
-- of an instrument.
--  
--  
-- * url : <http://www.csounds.com/manual/html/timeinsts.html>
 
timeinsts :: Krate
timeinsts = opcode "timeinsts" args
  where args = []


-- | * opcode : times
--  
--  
-- * syntax : 
--  
--  >   ires times
--  >   kres times
--  
--  
-- * description : 
--  
--  Read absolute time, in seconds, since the start of the
-- performance.
--  
--  
-- * url : <http://www.csounds.com/manual/html/times.html>
 
timesI :: Irate
timesI = opcode "times" args
  where args = []


-- | * opcode : times
--  
--  
-- * syntax : 
--  
--  >   ires times
--  >   kres times
--  
--  
-- * description : 
--  
--  Read absolute time, in seconds, since the start of the
-- performance.
--  
--  
-- * url : <http://www.csounds.com/manual/html/times.html>
 
timesK :: Krate
timesK = opcode "times" args
  where args = []


-- | * opcode : timek
--  
--  
-- * syntax : 
--  
--  >   ires timek
--  >   kres timek
--  
--  
-- * description : 
--  
--  Read absolute time, in k-rate cycles, since the start of the
-- performance.
--  
--  
-- * url : <http://www.csounds.com/manual/html/timek.html>
 
timekI :: Irate
timekI = opcode "timek" args
  where args = []


-- | * opcode : timek
--  
--  
-- * syntax : 
--  
--  >   ires timek
--  >   kres timek
--  
--  
-- * description : 
--  
--  Read absolute time, in k-rate cycles, since the start of the
-- performance.
--  
--  
-- * url : <http://www.csounds.com/manual/html/timek.html>
 
timekK :: Krate
timekK = opcode "timek" args
  where args = []


-- | * opcode : date
--  
--  
-- * syntax : 
--  
--  >   ir date
--  
--  
-- * description : 
--  
--  Returns the number seconds since 1 January 1970, using the
-- operating system's clock.
--  
--  
-- * url : <http://www.csounds.com/manual/html/date.html>
 
date :: Irate
date = opcode "date" args
  where args = []


-- | * opcode : dates
--  
--  
-- * syntax : 
--  
--  >   Sir dates [ itime]
--  
--  
-- * description : 
--  
--  Returns as a string the date and time specified.
--  
--  
-- * url : <http://www.csounds.com/manual/html/dates.html>
 
dates :: [Irate] -> String
dates i0init = opcode "dates" args
  where args = map to i0init