aTimer->tv_sec -= timer->mFireTime.tv_sec;
if (aTimer->tv_sec < timer->mFireTime.tv_sec) aTimer->tv_sec = timer->mFireTime.tv_sec - aTimer->tv_sec; else aTimer->tv_sec = 0;
int NS_TimeToNextTimeout(struct timeval *aTimer) {#ifndef MOZ_MONOLITHIC_TOOLKIT  static int once = 1;  if (once)  {    once = 0;    printf("NS_TimeToNextTimeout() lives!\n");  }#endif /* !MOZ_MONOLITHIC_TOOLKIT */  nsTimerXlib *timer;  timer = nsTimerXlib::gTimerList;  if (timer) {    if ((timer->mFireTime.tv_sec < aTimer->tv_sec) ||        ((timer->mFireTime.tv_sec == aTimer->tv_sec) &&         (timer->mFireTime.tv_usec <= aTimer->tv_usec))) {      aTimer->tv_sec = 0;      aTimer->tv_usec = 0;      return 1;    }    else {      aTimer->tv_sec -= timer->mFireTime.tv_sec;      // handle the overflow case      if (aTimer->tv_usec < timer->mFireTime.tv_usec) {        aTimer->tv_usec = timer->mFireTime.tv_usec - aTimer->tv_usec;        // make sure we don't go past zero when we decrement        if (aTimer->tv_sec)          aTimer->tv_sec--;      }      else {        aTimer->tv_usec -= timer->mFireTime.tv_usec;      }      return 1;    }  }  else {    return 0;  }}