private static int resolveTimeUnit(String unit) {
        if (unit.equalsIgnoreCase("second")) {
            return RrdGraphConstants.SECOND;
        }
        else if (unit.equalsIgnoreCase("minute")) {
            return RrdGraphConstants.MINUTE;
        }
        else if (unit.equalsIgnoreCase("hour")) {
            return RrdGraphConstants.HOUR;
        }
        else if (unit.equalsIgnoreCase("day")) {
            return RrdGraphConstants.DAY;
        }
        else if (unit.equalsIgnoreCase("week")) {
            return RrdGraphConstants.WEEK;
        }
        else if (unit.equalsIgnoreCase("month")) {
            return RrdGraphConstants.MONTH;
        }
        else if (unit.equalsIgnoreCase("year")) {
            return RrdGraphConstants.YEAR;
        }
        throw new IllegalArgumentException("Unknown time unit specified: " + unit);
    }