Time API and tests