Fix some time value changes; mostly changing greater than 1000000000 to greater than or equal to 1000000000. From Juha Niskanen

This commit is contained in:
Gregory Nutt 2015-02-20 07:07:36 -06:00
parent 63f88fc55f
commit cded7ea682
11 changed files with 17 additions and 17 deletions

View File

@ -638,7 +638,7 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
#ifdef CONFIG_STM32_I2C_DYNTIMEO
abstime.tv_nsec += 1000 * stm32_i2c_tousecs(priv->msgc, priv->msgv);
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;
@ -646,7 +646,7 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
#elif CONFIG_STM32_I2CTIMEOMS > 0
abstime.tv_nsec += CONFIG_STM32_I2CTIMEOMS * 1000 * 1000;
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;

View File

@ -646,7 +646,7 @@ static int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
#ifdef CONFIG_STM32_I2C_DYNTIMEO
abstime.tv_nsec += 1000 * stm32_i2c_tousecs(priv->msgc, priv->msgv);
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;
@ -654,7 +654,7 @@ static int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
#elif CONFIG_STM32_I2CTIMEOMS > 0
abstime.tv_nsec += CONFIG_STM32_I2CTIMEOMS * 1000 * 1000;
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;

View File

@ -673,7 +673,7 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
#ifdef CONFIG_STM32_I2C_DYNTIMEO
abstime.tv_nsec += 1000 * stm32_i2c_tousecs(priv->msgc, priv->msgv);
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;
@ -681,7 +681,7 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
#elif CONFIG_STM32_I2CTIMEOMS > 0
abstime.tv_nsec += CONFIG_STM32_I2CTIMEOMS * 1000 * 1000;
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;

View File

@ -812,7 +812,7 @@ static inline int tiva_i2c_sem_waitdone(struct tiva_i2c_priv_s *priv)
#ifdef CONFIG_TIVA_I2C_DYNTIMEO
abstime.tv_nsec += 1000 * tiva_i2c_tousecs(priv->msgc, priv->msgv);
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;
@ -820,7 +820,7 @@ static inline int tiva_i2c_sem_waitdone(struct tiva_i2c_priv_s *priv)
#elif CONFIG_TIVA_I2C_TIMEOMS > 0
abstime.tv_nsec += CONFIG_TIVA_I2C_TIMEOMS * 1000 * 1000;
if (abstime.tv_nsec > 1000 * 1000 * 1000)
if (abstime.tv_nsec >= 1000 * 1000 * 1000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000 * 1000 * 1000;

View File

@ -327,7 +327,7 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
abstime.tv_sec += sec;
abstime.tv_nsec += nsec;
if (abstime.tv_nsec > NSEC_PER_SEC)
if (abstime.tv_nsec >= NSEC_PER_SEC)
{
abstime.tv_sec++;
abstime.tv_nsec -= NSEC_PER_SEC;

View File

@ -187,7 +187,7 @@ int arp_wait(FAR struct arp_notify_s *notify, FAR struct timespec *timeout)
abstime.tv_sec += timeout->tv_sec;
abstime.tv_nsec += timeout->tv_nsec;
if (abstime.tv_nsec > 1000000000)
if (abstime.tv_nsec >= 1000000000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000000000;

View File

@ -191,7 +191,7 @@ int icmpv6_wait(FAR struct icmpv6_notify_s *notify,
abstime.tv_sec += timeout->tv_sec;
abstime.tv_nsec += timeout->tv_nsec;
if (abstime.tv_nsec > 1000000000)
if (abstime.tv_nsec >= 1000000000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000000000;

View File

@ -287,7 +287,7 @@ int icmpv6_rwait(FAR struct icmpv6_rnotify_s *notify,
abstime.tv_sec += timeout->tv_sec;
abstime.tv_nsec += timeout->tv_nsec;
if (abstime.tv_nsec > 1000000000)
if (abstime.tv_nsec >= 1000000000)
{
abstime.tv_sec++;
abstime.tv_nsec -= 1000000000;

View File

@ -198,7 +198,7 @@ ssize_t mq_timedreceive(mqd_t mqdes, FAR char *msg, size_t msglen,
return ERROR;
}
if (!abstime || abstime->tv_sec < 0 || abstime->tv_nsec > 1000000000)
if (!abstime || abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
{
set_errno(EINVAL);
return ERROR;

View File

@ -200,7 +200,7 @@ int mq_timedsend(mqd_t mqdes, FAR const char *msg, size_t msglen, int prio,
return ERROR;
}
if (!abstime || abstime->tv_sec < 0 || abstime->tv_nsec > 1000000000)
if (!abstime || abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
{
set_errno(EINVAL);
return ERROR;

View File

@ -147,7 +147,7 @@ static void sem_timeout(int argc, uint32_t pid)
* abstime - The absolute time to wait until a timeout is declared.
*
* Return Value:
* One success, the length of the selected message in bytes.is
* One success, the length of the selected message in bytes is
* returned. On failure, -1 (ERROR) is returned and the errno
* is set appropriately:
*
@ -198,7 +198,7 @@ int sem_timedwait(FAR sem_t *sem, FAR const struct timespec *abstime)
/* We will disable interrupts until we have completed the semaphore
* wait. We need to do this (as opposed to just disabling pre-emption)
* because there could be interrupt handlers that are asynchronoulsy
* because there could be interrupt handlers that are asynchronously
* posting semaphores and to prevent race conditions with watchdog
* timeout. This is not too bad because interrupts will be re-
* enabled while we are blocked waiting for the semaphore.
@ -223,7 +223,7 @@ int sem_timedwait(FAR sem_t *sem, FAR const struct timespec *abstime)
* with a valid timeout.
*/
if (abstime->tv_sec < 0 || abstime->tv_nsec > 1000000000)
if (abstime->tv_nsec < 0 || abstime->tv_nsec >= 1000000000)
{
err = EINVAL;
goto errout_disabled;