contract VariableTimeBonusRate {
    using SafeMath for uint256;

    // Struct specifying the stages of rate modification.
    struct RateModifier {
        // Percentage by which the rate should be modified.
        uint256 ratePermilles;

        // start time for a given rate
        uint256 start;
    }

    RateModifier[] private modifiers;

    /**
     * @dev Finds currently applicable rate modifier.
     * @return Current rate modifier percentage.
     */
    function currentModifier() public view returns (uint256 rateModifier) {
        // solium-disable-next-line security/no-block-members
        uint256 comparisonVariable = now;
        for (uint i = 0; i < modifiers.length; i++) {
            if (comparisonVariable >= modifiers[i].start) {
                rateModifier = modifiers[i].ratePermilles;
            }
        }
    }

    function getRateModifierInPermilles() public view returns (uint256) {
        return currentModifier();
    }

    /**
     * @dev Adds rate modifier checking not to add one with a start smaller than the previous.
     * @param _rateModifier RateModifier struct.
     */
    function pushModifier(RateModifier _rateModifier) internal {
        require(modifiers.length == 0 || _rateModifier.start > modifiers[modifiers.length - 1].start);
        modifiers.push(_rateModifier);
    }
}
/**
 * @title VariableTimeRate
 * @dev Contract with time dependent token distribution rate variable.
 */
function pushModifier(RateModifier _rateModifier) internal {
    require(modifiers.length == 0 || _rateModifier.start > modifiers[modifiers.length - 1].start);
    modifiers.push(_rateModifier);
}

/**
 * @dev Adds rate modifier checking not to add one with a start smaller than the previous.
 * @param _rateModifier RateModifier struct.
 */