Add timespec_diff() API and use it

Signed-off-by: Pekka Enberg <penberg@iki.fi>