import re


def extractTime(s):
    """Extract a time from a string of the form "%dm %4.2fs"
    which is what "time" generates.
    """
    msRe = r"([0-9]+)m +([0-9]+\.[0-9]+)s"
    matched = re.match(msRe, s)
    if matched:
        return 60 * int(matched.group(1)) + float(matched.group(2))
    # Maybe we don't have any minutes
    sRe = r"([0-9]+\.[0-9]+)s"
    matched = re.match(sRe, s)
    if matched:
        return float(matched.group(1))