unix/modtime: Fix time() precision on unix ports with non-double floats.
With MICROPY_FLOAT_IMPL_FLOAT the results of utime.time(), gmtime() and
localtime() change only every 129 seconds.  As one consequence
tests/extmod/vfs_lfs_mtime.py will fail on a unix port with LFS support.
With this patch these functions only return floats if
MICROPY_FLOAT_IMPL_DOUBLE is used.  Otherwise they return integers.
@@ -67,7 +67,7 @@ static inline int msec_sleep_tv(struct timeval *tv) {
#endif
STATIC mp_obj_t mod_time_time(void) {
- #if MICROPY_PY_BUILTINS_FLOAT
+ #if MICROPY_PY_BUILTINS_FLOAT && MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
struct timeval tv;
gettimeofday(&tv, NULL);
mp_float_t val = tv.tv_sec + (mp_float_t)tv.tv_usec / 1000000;
@@ -137,7 +137,7 @@ STATIC mp_obj_t mod_time_localtime(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
t = time(NULL);
} else {
- #if MICROPY_PY_BUILTINS_FLOAT
+ #if MICROPY_PY_BUILTINS_FLOAT && MICROPY_FLOAT_IMPL == MICROPY_FLOAT_IMPL_DOUBLE
mp_float_t val = mp_obj_get_float(args[0]);
t = (time_t)MICROPY_FLOAT_C_FUN(trunc)(val);
#else
