I'm trying to write a simple metronome program, but I can't find any suitable functions for obtaining or waiting fractions of a second? I'm currently using clock() and CLOCKS_PER_SEC but the performance is very bad even if I don't touch anything (i.e. the 'ticks' of the metronome are not at constant intervals). In any case I want to eventually extend the metronome program to provide cues at various pre-defined points in a song and using clock() will get worse the more other things are going on.
There must be a function to return time with greater accuracy than 1 second, I just can't find one. Any hints?
Edit: I should point out I'm developing on a Linux system, Ubuntu to be exact, using g++. I'm guessing time functions beyond the C++ might be platform and compiler specific?