class LangOps {

	public static Pair<Integer, TimeUnit> parseTimeUnit(String time) {
		time = Objects.requireNonNull(time).toLowerCase();
		TimeUnit timeUnit = null;
		int unitLength = 1;
		int times = 1;
		if (time.endsWith("mis")) {
			timeUnit = TimeUnit.MILLISECONDS;
			unitLength = 3;
		}else if (time.endsWith("mcs")) {
			timeUnit = TimeUnit.MICROSECONDS;
			unitLength = 3;
		}else if (time.endsWith("s")) {
			timeUnit = TimeUnit.SECONDS;
		}else if (time.endsWith("m")) {
			timeUnit = TimeUnit.MINUTES;
		}else if (time.endsWith("h")) {
			timeUnit = TimeUnit.HOURS;
		}else if (time.endsWith("d")) {
			timeUnit = TimeUnit.DAYS;
		}else if (time.endsWith("month")) {//月
			timeUnit = TimeUnit.DAYS;
			times = 30;//按30天算
		}else if (time.endsWith("y")) {//年
			timeUnit = TimeUnit.DAYS;
			times = 365;
		}else{
			unitLength = 0;
			timeUnit = TimeUnit.SECONDS;
		}
		int duration = Integer.valueOf(time.substring(0, time.length() - unitLength)) * times;
		return Pair.of(duration, timeUnit);
	}

	private  LangOps();

}