string test(TimeSpan t) {
	float time_in_seconds = t / TimeSpan.SECOND;
	float time_in_hours = t / TimeSpan.HOUR;

	if (time_in_seconds < 1)
	{
		return "Less than a second ago";
	}
	else if (time_in_seconds < 60)
	{
		return "Less than a minute ago";
	}
	else if (time_in_seconds < 60 * 10)
	{
		return "Less than 10 minutes ago";
	}
	else if (time_in_seconds < 60 * 30)
	{
		return "Half an hour ago";
	}
	else if (time_in_seconds < 60 * 60 * 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_seconds < 60 * 60 * 24 * 6)
	{
		int rounded_days =(int)Math.floor(time_in_hours / 24);
		return rounded_days <= 1 ? "A day ago" : "%d days ago".printf(rounded_days);
	}
	return null;
}

void main() {
    stdout.puts(test(TimeSpan.HOUR + 58 * TimeSpan.MINUTE) + "\n");
    stdout.puts(test(TimeSpan.DAY + 22 * TimeSpan.HOUR) + "\n");
}
