Add timer.c and timer.h to support various timeout scenarios.