Time support

This is just for review, don't merge yourself.

The modifications didn't change the API so it will go in the main branch soon.