mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 04:16:35 +08:00
!sys/types.h: change time_t and clock_t to int64_t to align with other OSes
POSIX leaves the signedness of time_t and clock_t unspecified, but
mainstream implementations (Linux glibc/musl, the BSDs, macOS, RTEMS,
Zephyr's POSIX layer, Windows _time64) expose time_t as signed 64-bit.
NuttX has historically used uint64_t only because it was tied to the
CONFIG_SYSTEM_TIME64 knob; with that gone, switch:
time_t : uint64_t -> int64_t
clock_t : uint64_t -> int64_t
CLOCK_MAX: UINT64_MAX -> INT64_MAX
This lets (time_t)-1 sentinels, negative tick deltas, and host-side
headers behave as on every other POSIX system without source churn.
Headers updated:
- include/sys/types.h, include/limits.h, include/nuttx/clock.h
- include/nuttx/fs/hostfs.h (nuttx_time_t alias)
- include/nuttx/{mqueue.h,wdog.h,wqueue.h,timers/clkcnt.h}
Because clock_t is now signed 64-bit, the NuttX-internal sclock_t
alias becomes redundant: every sclock_t/SCLOCK_MAX use is folded
back to clock_t/CLOCK_MAX (notably in sched/wdog, sched/mqueue,
sched/sched, sched/clock, sched/timer, libs/libc/time, fs/vfs and
the drivers/arch consumers below).
Tick/period constants (NSEC_PER_SEC, USEC_PER_SEC, MSEC_PER_SEC,
SEC_PER_MIN, ...) in include/nuttx/clock.h are retyped from "long"
literals to INT64_C(...) so that 64-bit arithmetic no longer
depends on the host's long width.
Strip now-redundant (time_t)/(clock_t)/(unsigned long) casts and
unsigned-only branches across the tree:
- arch RTC / oneshot / tickless lowerhalfs:
arm: cxd56xx, efm32, imxrt, lc823450, max326xx, sam34, sama5,
samd5e5, samv7, stm32, stm32f7, stm32h7, stm32l4, stm32wb,
xmc4
mips: pic32mz sparc: bm3803 x86_64: intel64
risc-v/xtensa: espressif (esp_i2c[_slave], esp_rtc,
esp32c3{_i2c,_rtc,_wifi_adapter}, esp32{,s2,s3}_*),
mpfs_perf
- drivers: audio/tone, input/aw86225, power/pm/{activity,
stability}_governor, rpmsg/rpmsg_ping,
timers/{ds3231,mcp794xx,pcf85263,rx8010},
wireless/ieee80211/bcm43xxx, wireless/spirit/spirit_spi
- core: fs/vfs/{fs_poll,fs_timerfd}, mm/iob/iob_alloc,
libs/libc/{netdb/lib_dnscache,time/{lib_calendar2utc,
lib_time}}, net/icmp/icmp_pmtu, net/icmpv6/icmpv6_pmtu,
net/ipfrag, net/tcp/{tcp.h,tcp_timer},
net/utils/net_snoop, net/mld/mld_query (drop the now-dead
mld_mrc2mrd helper since signed math handles it directly),
sched/clock/{clock,clock_initialize},
sched/sched/{sched_profil,sched_setparam,sched_setscheduler},
sched/pthread/pthread_create,
sched/wdog/{wd_gettime,wd_start,wdog.h},
sched/timer/timer_gettime, sched/mqueue/*
Flip the few in-tree printf format strings that assumed an
unsigned 64-bit tv_sec:
* drivers/rpmsg/rpmsg_ping.c PRIu64 -> PRId64
* arch/xtensa/src/esp32{,s2,s3}/esp32*_oneshot_lowerhalf.c
PRIu32 (already wrong) -> PRId64
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
@@ -394,7 +394,7 @@ time_t up_rtc_time(void)
|
||||
count += g_rtc_save->offset;
|
||||
count >>= 15; /* convert to 1sec resolution */
|
||||
|
||||
return (time_t)count / CONFIG_RTC_FREQUENCY;
|
||||
return count / CONFIG_RTC_FREQUENCY;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -398,7 +398,7 @@ int up_rtc_initialize(void)
|
||||
#ifndef CONFIG_RTC_HIRES
|
||||
time_t up_rtc_time(void)
|
||||
{
|
||||
return (time_t)efm32_get_burtc_tick() / CONFIG_RTC_FREQUENCY;
|
||||
return efm32_get_burtc_tick() / CONFIG_RTC_FREQUENCY;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -463,7 +463,7 @@ static int imxrt_rdalarm(struct rtc_lowerhalf_s *lower,
|
||||
|
||||
/* Get the current alarm setting in seconds */
|
||||
|
||||
alarm = (time_t)imxrt_hprtc_getalarm();
|
||||
alarm = imxrt_hprtc_getalarm();
|
||||
|
||||
/* Convert the one second epoch time to a struct tm */
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ static void tm_divider(struct tm *tm, int divn, int divm)
|
||||
{
|
||||
time_t tt;
|
||||
tt = timegm(tm);
|
||||
tt = (time_t) ((uint64_t)tt * divn / divm);
|
||||
tt = tt * divn / divm;
|
||||
gmtime_r(&tt, tm);
|
||||
}
|
||||
#endif /* CONFIG_RTC_DIV */
|
||||
|
||||
@@ -724,8 +724,8 @@ int up_rtc_gettime(struct timespec *tp)
|
||||
|
||||
/* And return the result to the caller. */
|
||||
|
||||
tp->tv_sec = (time_t)secs;
|
||||
tp->tv_nsec = (long)nsecs;
|
||||
tp->tv_sec = secs;
|
||||
tp->tv_nsec = nsecs;
|
||||
|
||||
tmrinfo("Returning tp=(%d,%d)\n", (int)tp->tv_sec, (int)tp->tv_nsec);
|
||||
return OK;
|
||||
|
||||
@@ -581,7 +581,7 @@ static int max326_rdalarm(struct rtc_lowerhalf_s *lower,
|
||||
{
|
||||
/* Extract integer seconds from the b32_t value */
|
||||
|
||||
time_t sec = (time_t)(b32toi(ftime));
|
||||
time_t sec = b32toi(ftime);
|
||||
|
||||
/* Convert to struct rtc_time (aka struct tm) */
|
||||
|
||||
|
||||
@@ -496,8 +496,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
}
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
|
||||
@@ -152,8 +152,8 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
uint64_t sec = usecs / 1000000;
|
||||
usecs -= 1000000 * sec;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (long)(usecs * 1000);
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = usecs * 1000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -507,8 +507,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
}
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
|
||||
@@ -154,8 +154,8 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
uint64_t sec = usecs / 1000000;
|
||||
usecs -= 1000000 * sec;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (long)(usecs * 1000);
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = usecs * 1000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -441,8 +441,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
}
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
|
||||
@@ -152,8 +152,8 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
uint64_t sec = usecs / 1000000;
|
||||
usecs -= 1000000 * sec;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (long)(usecs * 1000);
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = usecs * 1000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -506,8 +506,8 @@ int sam_oneshot_cancel(struct sam_oneshot_s *oneshot,
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
}
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
|
||||
@@ -152,8 +152,8 @@ static int sam_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
uint64_t sec = usecs / 1000000;
|
||||
usecs -= 1000000 * sec;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (long)(usecs * 1000);
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = usecs * 1000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -445,8 +445,8 @@ int stm32_oneshot_cancel(struct stm32_oneshot_s *oneshot,
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
}
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
|
||||
@@ -151,8 +151,8 @@ static int stm32_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
uint64_t sec = usecs / 1000000;
|
||||
usecs -= 1000000 * sec;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (long)(usecs * 1000);
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = usecs * 1000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -710,7 +710,7 @@ int up_timer_gettime(struct timespec *ts)
|
||||
|
||||
int up_timer_gettick(clock_t *ticks)
|
||||
{
|
||||
*ticks = (clock_t)STM32_TIM_GETCOUNTER(g_tickless.tch);
|
||||
*ticks = STM32_TIM_GETCOUNTER(g_tickless.tch);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -869,8 +869,8 @@ int up_timer_cancel(struct timespec *ts)
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
||||
|
||||
@@ -751,7 +751,7 @@ int up_timer_gettime(struct timespec *ts)
|
||||
|
||||
int up_timer_gettick(clock_t *ticks)
|
||||
{
|
||||
*ticks = (clock_t)STM32_TIM_GETCOUNTER(g_tickless.tch);
|
||||
*ticks = STM32_TIM_GETCOUNTER(g_tickless.tch);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -911,8 +911,8 @@ int up_timer_cancel(struct timespec *ts)
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
||||
|
||||
@@ -151,8 +151,8 @@ static int stm32_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
uint64_t sec = usecs / 1000000;
|
||||
usecs -= 1000000 * sec;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (long)(usecs * 1000);
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = usecs * 1000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -725,7 +725,7 @@ int up_timer_gettime(struct timespec *ts)
|
||||
|
||||
int up_timer_gettick(clock_t *ticks)
|
||||
{
|
||||
*ticks = (clock_t)STM32_TIM_GETCOUNTER(g_tickless.tch);
|
||||
*ticks = STM32_TIM_GETCOUNTER(g_tickless.tch);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -885,8 +885,8 @@ int up_timer_cancel(struct timespec *ts)
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
||||
|
||||
@@ -447,8 +447,8 @@ int stm32l4_oneshot_cancel(struct stm32l4_oneshot_s *oneshot,
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
}
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
|
||||
@@ -152,8 +152,8 @@ static int stm32l4_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
uint64_t sec = usecs / 1000000;
|
||||
usecs -= 1000000 * sec;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (long)(usecs * 1000);
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = usecs * 1000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -446,8 +446,8 @@ int stm32wb_oneshot_cancel(struct stm32wb_oneshot_s *oneshot,
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
}
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
|
||||
@@ -152,8 +152,8 @@ static int stm32wb_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
uint64_t sec = usecs / 1000000;
|
||||
usecs -= 1000000 * sec;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (long)(usecs * 1000);
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = usecs * 1000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -576,7 +576,7 @@ int up_timer_gettime(struct timespec *ts)
|
||||
|
||||
int up_timer_gettick(clock_t *ticks)
|
||||
{
|
||||
*ticks = (clock_t)STM32WB_TIM_GETCOUNTER(g_tickless.tch);
|
||||
*ticks = STM32WB_TIM_GETCOUNTER(g_tickless.tch);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -735,8 +735,8 @@ int up_timer_cancel(struct timespec *ts)
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = (usec - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
||||
|
||||
@@ -563,8 +563,8 @@ int up_timer_cancel(struct timespec *ts)
|
||||
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
|
||||
tmrinfo("remaining count : %lu (%lu, %lu)\n", count,
|
||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
||||
|
||||
@@ -301,7 +301,7 @@ static void avrdx_check_alarm_expired(uint8_t context)
|
||||
|
||||
/* Note about data types - struct timespec is defined
|
||||
* in include/time.h, tv_sec is of type time_t which is defined
|
||||
* in include/sys/types.h as uint64_t.
|
||||
* in include/sys/types.h as int64_t.
|
||||
*
|
||||
* tv_nsec is defined as long, signed value
|
||||
*/
|
||||
|
||||
@@ -433,8 +433,8 @@ int pic32mz_oneshot_cancel(struct pic32mz_oneshot_s *oneshot,
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
}
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
|
||||
@@ -153,8 +153,8 @@ static int pic32mz_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
uint64_t sec = usecs / 1000000;
|
||||
usecs -= 1000000 * sec;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (long)(usecs * 1000);
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = usecs * 1000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -1052,7 +1052,7 @@ static int esp_i2c_polling_waitdone(struct esp_i2c_priv_s *priv)
|
||||
* and an error didn't occur within the timeout
|
||||
*/
|
||||
|
||||
while ((sclock_t)(current - timeout) < 0 && (priv->error == 0))
|
||||
while (current - timeout < 0 && priv->error == 0)
|
||||
{
|
||||
/* Check if any interrupt triggered, clear them
|
||||
* process the operation.
|
||||
|
||||
@@ -679,7 +679,7 @@ static int esp_i2c_slave_polling_waitdone(struct esp_i2c_priv_s *priv)
|
||||
current = clock_systime_ticks();
|
||||
timeout = current + SEC2TICK(I2C_SLAVE_POLL_RATE);
|
||||
|
||||
while ((sclock_t)(current - timeout) < 0)
|
||||
while (current - timeout < 0)
|
||||
{
|
||||
/* Check if any interrupt triggered, clear them
|
||||
* process the operation.
|
||||
|
||||
@@ -699,7 +699,7 @@ time_t up_rtc_time(void)
|
||||
|
||||
spin_unlock_irqrestore(&g_rtc_lowerhalf.lock, flags);
|
||||
|
||||
return (time_t)(time_us / USEC_PER_SEC);
|
||||
return time_us / USEC_PER_SEC;
|
||||
}
|
||||
#endif /* !CONFIG_RTC_HIRES */
|
||||
|
||||
|
||||
@@ -846,7 +846,7 @@ static int esp32c3_i2c_polling_waitdone(struct esp32c3_i2c_priv_s *priv)
|
||||
* and an error didn't occur within the timeout
|
||||
*/
|
||||
|
||||
while ((sclock_t)(current - timeout) < 0 && (priv->error == 0))
|
||||
while (current - timeout < 0 && priv->error == 0)
|
||||
{
|
||||
/* Check if any interrupt triggered, clear them
|
||||
* process the operation.
|
||||
|
||||
@@ -3108,7 +3108,7 @@ time_t up_rtc_time(void)
|
||||
|
||||
spin_unlock_irqrestore(&g_rtc_lock, flags);
|
||||
|
||||
return (time_t)(time_us / USEC_PER_SEC);
|
||||
return time_us / USEC_PER_SEC;
|
||||
}
|
||||
#endif /* !CONFIG_RTC_HIRES */
|
||||
|
||||
|
||||
@@ -3289,8 +3289,8 @@ static int esp_get_time(void *t)
|
||||
ret = gettimeofday(&tv, NULL);
|
||||
if (!ret)
|
||||
{
|
||||
time_adpt->sec = (time_t)tv.tv_sec;
|
||||
time_adpt->usec = (suseconds_t)tv.tv_usec;
|
||||
time_adpt->sec = tv.tv_sec;
|
||||
time_adpt->usec = tv.tv_usec;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ void up_udelay(useconds_t microseconds)
|
||||
{
|
||||
clock_t start = up_perf_gettime();
|
||||
clock_t end = microseconds * up_perf_getfreq() / USEC_PER_SEC + start + 1;
|
||||
while (((sclock_t)(up_perf_gettime() - end)) < 0)
|
||||
while (up_perf_gettime() - end < 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -389,8 +389,8 @@ int bm3803_oneshot_cancel(struct bm3803_oneshot_s *oneshot,
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
}
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
|
||||
@@ -154,8 +154,8 @@ static int bm3803_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
uint64_t sec = usecs / 1000000;
|
||||
usecs -= 1000000 * sec;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (long)(usecs * 1000);
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = usecs * 1000;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -461,8 +461,8 @@ int intel64_oneshot_cancel(struct intel64_oneshot_s *oneshot,
|
||||
sec = usec / USEC_PER_SEC;
|
||||
nsec = ((usec) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts->tv_sec = (time_t)sec;
|
||||
ts->tv_nsec = (unsigned long)nsec;
|
||||
ts->tv_sec = sec;
|
||||
ts->tv_nsec = nsec;
|
||||
|
||||
tmrinfo("remaining (%lu, %lu)\n",
|
||||
(unsigned long)ts->tv_sec, (unsigned long)ts->tv_nsec);
|
||||
|
||||
@@ -694,7 +694,7 @@ static int esp_i2c_slave_polling_waitdone(struct esp_i2c_priv_s *priv)
|
||||
current = clock_systime_ticks();
|
||||
timeout = current + SEC2TICK(I2C_SLAVE_POLL_RATE);
|
||||
|
||||
while ((sclock_t)(current - timeout) < 0)
|
||||
while (current - timeout < 0)
|
||||
{
|
||||
/* Check if any interrupt triggered, clear them
|
||||
* process the operation.
|
||||
|
||||
@@ -698,7 +698,7 @@ time_t up_rtc_time(void)
|
||||
|
||||
spin_unlock_irqrestore(&g_rtc_lowerhalf.lock, flags);
|
||||
|
||||
return (time_t)(time_us / USEC_PER_SEC);
|
||||
return time_us / USEC_PER_SEC;
|
||||
}
|
||||
#endif /* !CONFIG_RTC_HIRES */
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ static int esp32_max_lh_delay(struct oneshot_lowerhalf_s *lower,
|
||||
ts->tv_sec = UINT32_MAX;
|
||||
ts->tv_nsec = NSEC_PER_SEC - 1;
|
||||
|
||||
tmrinfo("max sec=%" PRIu32 "\n", ts->tv_sec);
|
||||
tmrinfo("max sec=%" PRId64 "\n", ts->tv_sec);
|
||||
tmrinfo("max nsec=%" PRId32 "\n", ts->tv_nsec);
|
||||
|
||||
return OK;
|
||||
|
||||
@@ -2594,8 +2594,8 @@ static int esp_get_time(void *t)
|
||||
ret = gettimeofday(&tv, NULL);
|
||||
if (!ret)
|
||||
{
|
||||
time_adpt->sec = (time_t)tv.tv_sec;
|
||||
time_adpt->usec = (suseconds_t)tv.tv_usec;
|
||||
time_adpt->sec = tv.tv_sec;
|
||||
time_adpt->usec = tv.tv_usec;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -155,7 +155,7 @@ static int oneshot_lh_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
ts->tv_sec = UINT32_MAX;
|
||||
ts->tv_nsec = NSEC_PER_SEC - 1;
|
||||
|
||||
tmrinfo("max sec=%" PRIu32 "\n", ts->tv_sec);
|
||||
tmrinfo("max sec=%" PRId64 "\n", ts->tv_sec);
|
||||
tmrinfo("max nsec=%ld\n", ts->tv_nsec);
|
||||
|
||||
return OK;
|
||||
|
||||
@@ -2412,8 +2412,8 @@ static int esp_get_time(void *t)
|
||||
ret = gettimeofday(&tv, NULL);
|
||||
if (!ret)
|
||||
{
|
||||
time_adpt->sec = (time_t)tv.tv_sec;
|
||||
time_adpt->usec = (suseconds_t)tv.tv_usec;
|
||||
time_adpt->sec = tv.tv_sec;
|
||||
time_adpt->usec = tv.tv_usec;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -155,7 +155,7 @@ static int oneshot_lh_max_delay(struct oneshot_lowerhalf_s *lower,
|
||||
ts->tv_sec = UINT32_MAX;
|
||||
ts->tv_nsec = NSEC_PER_SEC - 1;
|
||||
|
||||
tmrinfo("max sec=%" PRIu32 "\n", ts->tv_sec);
|
||||
tmrinfo("max sec=%" PRId64 "\n", ts->tv_sec);
|
||||
tmrinfo("max nsec=%ld\n", ts->tv_nsec);
|
||||
|
||||
return OK;
|
||||
|
||||
@@ -2584,8 +2584,8 @@ static int esp_get_time(void *t)
|
||||
ret = gettimeofday(&tv, NULL);
|
||||
if (!ret)
|
||||
{
|
||||
time_adpt->sec = (time_t)tv.tv_sec;
|
||||
time_adpt->usec = (suseconds_t)tv.tv_usec;
|
||||
time_adpt->sec = tv.tv_sec;
|
||||
time_adpt->usec = tv.tv_usec;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -377,8 +377,8 @@ static void next_note(FAR struct tone_upperhalf_s *upper)
|
||||
sec = duration / USEC_PER_SEC;
|
||||
nsec = ((duration) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts.tv_sec = (time_t) sec;
|
||||
ts.tv_nsec = (unsigned long)nsec;
|
||||
ts.tv_sec = sec;
|
||||
ts.tv_nsec = nsec;
|
||||
|
||||
ONESHOT_START(upper->oneshot, &ts);
|
||||
|
||||
@@ -511,8 +511,8 @@ static void next_note(FAR struct tone_upperhalf_s *upper)
|
||||
sec = duration / USEC_PER_SEC;
|
||||
nsec = ((duration) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts.tv_sec = (time_t) sec;
|
||||
ts.tv_nsec = (unsigned long)nsec;
|
||||
ts.tv_sec = sec;
|
||||
ts.tv_nsec = nsec;
|
||||
|
||||
ONESHOT_START(upper->oneshot, &ts);
|
||||
return;
|
||||
@@ -554,8 +554,8 @@ static void next_note(FAR struct tone_upperhalf_s *upper)
|
||||
sec = duration / USEC_PER_SEC;
|
||||
nsec = ((duration) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts.tv_sec = (time_t) sec;
|
||||
ts.tv_nsec = (unsigned long)nsec;
|
||||
ts.tv_sec = sec;
|
||||
ts.tv_nsec = nsec;
|
||||
|
||||
ONESHOT_START(upper->oneshot, &ts);
|
||||
|
||||
@@ -636,8 +636,8 @@ static void next_note(FAR struct tone_upperhalf_s *upper)
|
||||
sec = duration / USEC_PER_SEC;
|
||||
nsec = ((duration) - (sec * USEC_PER_SEC)) * NSEC_PER_USEC;
|
||||
|
||||
ts.tv_sec = (time_t) sec;
|
||||
ts.tv_nsec = (unsigned long)nsec;
|
||||
ts.tv_sec = sec;
|
||||
ts.tv_nsec = nsec;
|
||||
|
||||
/* And arrange a callback when the note should stop */
|
||||
|
||||
|
||||
@@ -2144,7 +2144,7 @@ static int aw86225_haptics_upload_effect(FAR struct ff_lowerhalf_s *lower,
|
||||
FAR struct aw86225 *aw86225 = (FAR struct aw86225 *)lower;
|
||||
FAR struct aw86225_hap_play_info *play = &aw86225->play;
|
||||
int16_t data[AW86225_CUSTOM_DATA_LEN];
|
||||
sclock_t time_us;
|
||||
clock_t time_us;
|
||||
int ret;
|
||||
|
||||
time_us = wd_gettime(&aw86225->timer);
|
||||
|
||||
@@ -573,10 +573,10 @@ static void governor_timer(int domain, enum pm_state_e newstate)
|
||||
|
||||
if (newstate < PM_SLEEP && dq_empty(&pdom->wakelock[newstate]))
|
||||
{
|
||||
sclock_t delay = pmtick[newstate] +
|
||||
pdomstate->btime -
|
||||
clock_systime_ticks();
|
||||
sclock_t left = wd_gettime(&pdomstate->wdog);
|
||||
clock_t delay = pmtick[newstate] +
|
||||
pdomstate->btime -
|
||||
clock_systime_ticks();
|
||||
clock_t left = wd_gettime(&pdomstate->wdog);
|
||||
|
||||
if (delay <= 0)
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user