Add header include for use of errno
Fix include of time.h

In case this is compiled for RIoT, the header does not
necessarily have the extern C def.
Remove old code