I may be missing something, but I'm not sure I quite understand this line.
prev_t += now; // keep track of last time.
Did you perhaps mean prev_t = now? I tried the code with = now instead, and it works like a charm! The only thing I don't quite understand is how the if statement is working. Wouldn't "now - prev_t" always simply be 1?