def time_from_match(match_object):
    """Create a time object from a regular expression match.

    The regular expression match is expected to be from RE_TIME or RE_DATETIME.

    @param match_object: The regular expression match.
    @type value: B{re}.I{MatchObject}
    @return: A date object.
    @rtype: B{datetime}.I{time}

    """
    hour = int(match_object.group('hour'))
    minute = int(match_object.group('minute'))
    second = int(match_object.group('second'))
    subsecond = match_object.group('subsecond')

    microsecond = 0
    if subsecond is not None:
        subsecond_denominator = 10.0 ** len(subsecond)
        subsecond = int(subsecond)
        microsecond = subsecond * (1000000 / subsecond_denominator)
        microsecond = int(round(microsecond))

    return datetime.time(hour, minute, second, microsecond)