rtclock

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

Description

Read the real-time clock from the operating system.

Syntax

ir rtclock

kr 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 files rtclock.orc and rtclock.sco.

Example 1. Example of the rtclock opcode.

/* rtclock.orc */
; 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
/* rtclock.orc */
        
/* rtclock.sco */
; Play Instrument #1 for two seconds.
i 1 0 2
e
/* rtclock.sco */
        
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