MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / modGetTimeOfDay

Function modGetTimeOfDay

xs/platforms/esp/xsHost.c:678–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676static uint8_t gRTCInit = false;
677
678void modGetTimeOfDay(struct modTimeVal *tv, struct modTimeZone *tz)
679{
680#if !ESP32
681 if (!gRTCInit) {
682 rtctime_early_startup();
683 rtctime_late_startup();
684 gRTCInit = true;
685 modSetTime(819195899);
686 }
687#endif
688
689 if (tv) {
690 struct rtc_timeval rtc_tv;
691
692 rtctime_gettimeofday(&rtc_tv);
693 tv->tv_sec = rtc_tv.tv_sec;
694 tv->tv_usec = rtc_tv.tv_usec;
695 }
696
697 if (tz) {
698 tz->tz_minuteswest = gTimeZoneOffset;
699 tz->tz_dsttime = gDaylightSavings;
700 }
701}
702
703void modSetTime(uint32_t seconds)
704{

Callers 1

xs_time_microsecondsFunction · 0.50

Calls 1

modSetTimeFunction · 0.70

Tested by

no test coverage detected