//We are passing some value by calling test function

string test(TimeSpan t) {
	float time_in_seconds = (float)t / TimeSpan.SECOND;
	stdout.printf("Time in seconds is %f\n", time_in_seconds);
	float time_in_hours = (float) t / TimeSpan.HOUR;
	stdout.printf("Time in hours is %f\n", time_in_hours);

		if (time_in_seconds < 60)
		{
			return "A minute ago";
		}
		else if (time_in_seconds < 60 * 30)
		{
			return "%d minutes ago".printf((int)Math.round(time_in_seconds / 60));
		}
		else if (time_in_seconds < 60 * 40)
		{
			return "Half an hour ago";
		}
		else if (time_in_hours < 24)
		{
			int rounded_hours = (int)Math.round(time_in_hours);
			return rounded_hours == 1 ? "An hour ago" : "%d hours ago".printf(rounded_hours);
		}
		else if (time_in_hours < 24 * 6)
		{
			int rounded_days = (int)Math.round(time_in_hours / 24);
			return rounded_days == 1 ? "A day ago" : "%d days ago".printf(rounded_days);
		}
		
	return "More than a week";
}

void main() {
	stdout.printf("10 seconds: %s\n", test(1 * TimeSpan.SECOND));
	stdout.printf("5 mins: %s\n", test(5 * TimeSpan.MINUTE));
	stdout.printf("25 mins: %s\n", test(25 * TimeSpan.MINUTE));
	stdout.printf("35 mins: %s\n", test(35 * TimeSpan.MINUTE));
	stdout.printf("38 mins: %s\n", test(38 * TimeSpan.MINUTE));
	stdout.printf("45 mins: %s\n", test(45 * TimeSpan.MINUTE));
	stdout.printf("50 mins: %s\n", test(50 * TimeSpan.MINUTE));
	stdout.printf("1 hr 5 mins: %s\n", test(65 * TimeSpan.MINUTE));
	stdout.printf("1 hr 25 mins: %s\n", test(85 * TimeSpan.MINUTE));
	stdout.printf("1 hr 35 mins: %s\n", test(95 * TimeSpan.MINUTE));
	stdout.printf("2 hr 05 mins: %s\n", test(125 * TimeSpan.MINUTE));
	stdout.printf("6 hr 34 mins: %s\n", test(6*TimeSpan.HOUR + 34 * TimeSpan.MINUTE));
}
