static time_t expire_calc()

in src/request/apache_request.c [685:714]


static time_t expire_calc(char *time_str)
{
    int is_neg = 0, offset = 0;
    char buf[256];
    int ix = 0;

    if (*time_str == '-') {
        is_neg = 1;
        ++time_str;
    }
    else if (*time_str == '+') {
        ++time_str;
    }
    else if (strcaseEQ(time_str, "now")) {
        /*ok*/
    }
    else {
        return 0;
    }

    /* wtf, ap_isdigit() returns false for '1' !? */
    while (*time_str && (apr_isdigit(*time_str) || (*time_str == '1'))) {
        buf[ix++] = *time_str++;
    }
    buf[ix] = '\0';
    offset = atoi(buf);

    return time(NULL) +
        (expire_mult(*time_str) * (is_neg ? (0 - offset) : offset));
}