Exemplo n.º 1
0
static inline void clock_basetime(FAR struct timespec *tp)
{
  struct tm rtctime;

  /* Get the broken-out time from the date/time RTC. */

  (void)up_rtc_getdatetime(&rtctime);

  /* And use the broken-out time to initialize the system time */

  tp->tv_sec  = mktime(&rtctime);
  tp->tv_nsec = 0;
}
Exemplo n.º 2
0
static inline int clock_basetime(FAR struct timespec *tp)
{
  struct tm rtctime;
  int ret;

  /* Get the broken-out time from the date/time RTC. */

  ret = up_rtc_getdatetime(&rtctime);
  if (ret >= 0)
    {
      /* And use the broken-out time to initialize the system time */

      tp->tv_sec  = mktime(&rtctime);
      tp->tv_nsec = 0;
    }

  return ret;
}