fix bug with C-level callbacks

document API better

gettimeofday isn't portable -- avoid it?
