def convert_timestring_to_secs(timestring):
    """Convert a Jenkins-style duration string into floating point seconds."""
    tokens = timestring.split(' ')

    if (len(tokens) % 2) != 0:
        # We don't have pairs, so something went wrong in the parsing.
        return None
    pairs = zip(tokens[0::2], tokens[1::2])

    # These are defined in core/src/main/resources/hudson/Messages.properties and
    # core/src/main/java/hudson/Util.java.
    seconds_mapping = {
        'ms': 0.001,
        'sec': 1.0,
        'min': 60.0,
        'hr': 3600.0,
        'day': 24 * 3600.0,
        'days': 24 * 3600.0,
        'mo': 30 * 24 * 3600.0,
        'yr': 365 * 24 * 3600.0,
    }

    seconds = 0.0
    for amount, unit in pairs:
        if unit not in seconds_mapping:
            return None

        try:
            int_amount = int(amount)
        except ValueError:
            return None

        seconds += int_amount * seconds_mapping[unit]

    return seconds