sys/time.h: Fix timersub macro; time_t is unsigned

This commit is contained in:
Gregory Nutt 2015-12-31 09:05:35 -06:00
parent b73a7515b6
commit b1938c065d
4 changed files with 11 additions and 9 deletions

View file

@ -11263,3 +11263,4 @@
struct sigevent. This initial implementation will only work in the
FLAT build. See the top-level TODO file for additional details
(2015-12-30).

View file

@ -50,7 +50,7 @@
#include <stdbool.h> /* C99 boolean types */
#include <unistd.h> /* For getpid */
#include <semaphore.h> /* Needed for sem_t */
#include <signal.h> /* Needed for sigset_t */
#include <signal.h> /* Needed for sigset_t, includes this file */
#include <time.h> /* Needed for struct timespec */
/********************************************************************************
@ -441,8 +441,8 @@ int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset);
#include <sys/types.h>
#include <stdbool.h>
/* Avoid a circular dependencies by assuring that simple type definitions
* are avaiable in any inclusion ordering.
/* Avoid circular dependencies by assuring that simple type definitions are
* available in any inclusion ordering.
*/
#ifndef __PTHREAD_KEY_T_DEFINED

View file

@ -45,8 +45,9 @@
#include <stdint.h>
#include <time.h>
#ifdef CONFIG_SIG_EVTHREAD
# include <pthread.h> /* Needed for pthread_attr_t */
# include <pthread.h> /* Needed for pthread_attr_t, includes this file */
#endif
/********************************************************************************
@ -320,8 +321,8 @@ int sigqueue(int pid, int signo, FAR void *sival_ptr);
#include <stdint.h>
/* Avoid a circular dependencies by assuring that simple type definitions
* are avaiable in any inclusion ordering.
/* Avoid circular dependencies by assuring that simple type definitions are
* available in any inclusion ordering.
*/
#ifndef __SIGSET_T_DEFINED

View file

@ -78,12 +78,12 @@
do \
{ \
(vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
if ((vvp)->tv_usec < 0) \
if ((uvp)->tv_usec > (tvp)->tv_usec) \
{ \
(vvp)->tv_sec--; \
(vvp)->tv_usec += 1000000; \
(tvp)->tv_usec += 1000000; \
} \
(vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
} \
while (0)