Cast interval values to ints before use, so we don't get sign issues with time_t. Fixes #659