improve timer and clock abstraction