void rtctime_settimeofday (const struct rtc_timeval *tv) { if (!rtc_time_check_magic ()) rtc_time_prepare (); int32_t rate = rtc_time_get_rate(); rtc_time_settimeofday (tv); rtc_time_set_rate(rate); }
// rtctime.set (sec, usec) static int rtctime_set (lua_State *L) { if (!rtc_time_check_magic ()) rtc_time_prepare (); uint32_t sec = luaL_checknumber (L, 1); uint32_t usec = 0; if (lua_isnumber (L, 2)) usec = lua_tonumber (L, 2); struct rtc_timeval tv = { sec, usec }; rtctime_settimeofday (&tv); return 0; }
void rtctime_settimeofday (const struct rtc_timeval *tv) { if (!rtc_time_check_magic ()) rtc_time_prepare (); rtc_time_settimeofday (tv); }