def getTimeString(seconds):
    """
    Get a pretty time string, using hours, minutes, seconds and milliseconds as required.
    :param seconds: The desired time span, given in seconds. Can be an int or a float.
    :return: A string representing the desired time span, given in hours, minutes, seconds and milliseconds.
    """
    units = list()
    msecs = (seconds % 1) * 1000
    if msecs >= 1:
        units.append('{0}ms'.format(int(msecs % 60)))
    units.append('{0}s'.format(int(seconds % 60)))
    minutes = seconds/60
    if minutes >= 1:
        units.append('{0}m'.format(int(minutes % 60)))
        hours = minutes/60
        if hours >= 1:
            units.append('{0}h'.format(int(hours % 60)))
    return ' '.join(units[::-1])