def getYearsAsList(macroDemand, startYear, endYear):
    """ Return a sorted list containing only the years (or "time steps"). """

    years = macroDemand.keys()
    years.sort()
    for i in range(len(years)):
        years[i] = int(years[i])
    startIndex = years.index(startYear)
    endIndex = years.index(endYear)
    listYears = years[startIndex : endIndex + 1]
    return listYears