rtclock
Prev | Orchestra Opcodes and Operators | Next

## rtclock

rtclock — Read the real time clock from the operating system.

## Description

Read the real-time clock from the operating system.

## Syntax

    ires rtclock

    kres rtclock

## Performance

Read the real-time clock from operating system. Under Windows, this changes only once per second. Under GNU/Linux, it ticks every microsecond. Performance under other systems varies.

## Examples

Here is an example of the rtclock opcode. It uses the file rtclock.csd.

Example 412. Example of the rtclock opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

    <CsoundSynthesizer>
    <CsOptions>
    ; Select audio/midi flags here according to platform
    ; Audio out   Audio in
    -odac           -iadc    ;;;RT audio I/O
    ; For Non-realtime ouput leave only the line below:
    ; -o rtclock.wav -W ;;; for file output any platform
    </CsOptions>
    <CsInstruments>

    ; Initialize the global variables.
    sr = 44100
    kr = 44100
    ksmps = 1
    nchnls = 1

    ; Instrument #1
    instr 1
      ; Get the system time.
      k1 rtclock
      ; Print it once per second.
      printk 1, k1
    endin

    </CsInstruments>
    <CsScore>

    ; Play Instrument #1 for two seconds.
    i 1 0 2
    e

    </CsScore>
    </CsoundSynthesizer>

Its output should include lines like this:

     i   1 time     0.00002: 1018236096.00000
     i   1 time     1.00002: 1018236224.00000

## Credits

Author: John ffitch

Example written by Kevin Conder.

New in version 4.10

Prev | Up | Next
rspline | Home | s16b14