Musl time

Migrates time handling to musl.

This pull request is NOT yet ready for merge, but I wanted to put it up already to relate to #2393.