Time management library for embedded devices