time:follow POSIX use long to define time_t

MIRTOS-883
https: //man7.org/linux/man-pages/man3/clock_settime.3.html
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Change-Id: If573ad33b1ff61d5549e476b191309d4d4024801
This commit is contained in:
anjiahao
2021-10-13 12:29:19 +08:00
parent 725f98bb06
commit 6bcd83eb04
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -102,7 +102,7 @@
/* Scalar types */
typedef uint32_t time_t; /* Holds time in seconds */
typedef long time_t; /* Holds time in seconds */
typedef uint8_t clockid_t; /* Identifies one time base source */
typedef FAR void *timer_t; /* Represents one POSIX timer */
+2 -1
View File
@@ -65,7 +65,8 @@ int clock_settime(clockid_t clock_id, FAR const struct timespec *tp)
*/
if (clock_id == CLOCK_REALTIME &&
tp->tv_nsec >= 0 && tp->tv_nsec < 1000000000)
tp->tv_nsec >= 0 && tp->tv_nsec < 1000000000 &&
tp->tv_sec >= 0)
{
#ifndef CONFIG_CLOCK_TIMEKEEPING
/* Interrupts are disabled here so that the in-memory time