On Carnival you can book a cruise up to 24 hours before departure. There is no guarantee that there will be open cabins at that time. Cruise ships fill their ships up before that time.
I have done a lot of cruises within two or three months before sailing. I have found the best prices are usually right after final payment which is around 70 days before sailing.