os/time: include time.h in os/time.h

Include what you use, also in the positive direction.
os/time: make os_get_localtime more portable

gettimeofday() doesn't exist on Windows, as reported by @equalsraf. It seems
a call to time() would be sufficient here, as only the seconds since the
UNIX epoch are needed.
os/time: fix os_localtime_r on win + add func_attr

- it makes no sense for these functions to take NULL pointers
- if `localtime()` on Windows returns a NULL pointer, the old code would try
  to dereference it.
Merge #965 'Make os_get_localtime() portable + fix bug on win'