deps/libssh-0.6.3/src/misc.c
int ssh_timeout_elapsed(struct ssh_timestamp *ts, int timeout) {
    struct ssh_timestamp now;

    switch(timeout) {
        case -2: /*
                  * -2 means user-defined timeout as available in
                  * session->timeout, session->timeout_usec.
                  */
            fprintf(stderr, "ssh_timeout_elapsed called with -2. this needs to "
                            "be fixed. please set a breakpoint on %s:%d and "
                            "fix the caller\n", __FILE__, __LINE__);
        case -1: /* -1 means infinite timeout */
            return 0;
        case 0: /* 0 means no timeout */
            return 1;
        default:
            break;
    }

    ssh_timestamp_init(&now);

    return (ssh_timestamp_difference(ts,&now) >= timeout);
}
/**
 * @internal
 * @brief Checks if a timeout is elapsed, in function of a previous
 * timestamp and an assigned timeout
 * @param[in] ts pointer to an existing timestamp
 * @param[in] timeout timeout in milliseconds. Negative values mean infinite
 *                   timeout
 * @returns 1 if timeout is elapsed
 *          0 otherwise
 */
@internal
@brief Checks if a timeout is elapsed, in function of a previous
timestamp and an assigned timeout
@param[in] ts pointer to an existing timestamp
@param[in] timeout timeout in milliseconds. Negative values mean infinite
timeout
@returns 1 if timeout is elapsed
0 otherwise
@internal @brief Checks if a timeout is elapsed in function of a previous timestamp and an assigned timeout @param [ in ] ts pointer to an existing timestamp @param [ in ] timeout timeout in milliseconds . Negative values mean infinite timeout @returns 1 if timeout is elapsed 0 otherwise
int ssh_timeout_elapsed(struct ssh_timestamp *ts, int timeout) {
    struct ssh_timestamp now;
    switch(timeout) {
        case -2: 
            fprintf(stderr, "ssh_timeout_elapsed called with -2. this needs to "
                            "be fixed. please set a breakpoint on %s:%d and "
                            "fix the caller\n", __FILE__, __LINE__);
        case -1: 
            return 0;
        case 0: 
            return 1;
        default:
            break;
    }
    ssh_timestamp_init(&now);
    return (ssh_timestamp_difference(ts,&now) >= timeout);
}
int ssh_timeout_elapsed ( struct ssh_timestamp * ts , int timeout ) { struct ssh_timestamp now ; switch ( timeout ) { case -2 : fprintf ( stderr , " " " " " \n " , __FILE__ , __LINE__ ) ; case -1 : return 0 ; case 0 : return 1 ; default : break ; } ssh_timestamp_init ( & now ) ; return ( ssh_timestamp_difference ( ts , & now ) >= timeout ) ; }
@internal
 @brief Checks if a timeout is elapsed, in function of a previous
 timestamp and an assigned timeout
 @param[in] ts pointer to an existing timestamp
 @param[in] timeout timeout in milliseconds.
@internal @brief Checks if a timeout is elapsed in function of a previous timestamp and an assigned timeout @param [ in ] ts pointer to an existing timestamp @param [ in ] timeout timeout in milliseconds .
/*
                  * -2 means user-defined timeout as available in
                  * session->timeout, session->timeout_usec.
                  */ /* -1 means infinite timeout */ /* 0 means no timeout */