esp32/modutime: Add time.time() function.
#include <stdio.h>
#include <string.h>
+#include <sys/time.h>
#include "extmod/utime_mphal.h"
+STATIC mp_obj_t time_time(void) {
+ struct timeval tv;
+ gettimeofday(&tv, NULL);
+ return mp_obj_new_int(tv.tv_sec);
+}
+MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time);
+
STATIC const mp_rom_map_elem_t time_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_utime) },
+ { MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&time_time_obj) },
{ MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mp_utime_sleep_obj) },
{ MP_ROM_QSTR(MP_QSTR_sleep_ms), MP_ROM_PTR(&mp_utime_sleep_ms_obj) },
{ MP_ROM_QSTR(MP_QSTR_sleep_us), MP_ROM_PTR(&mp_utime_sleep_us_obj) },
