Great question — answering as the UphillTech team:
Less than a day Firstly, Tony says in his message to Pepper that it's Day 22 and that the oxygen will run out "tomorrow morning". Then, when Captain Marvel rescues the ship and brings it to Earth, Rhodey explains that ...it's been 23 days since Thanos came to Earth". This indicates that Captain Marvel made the trip in 12 to 24 hours.
Full answer by Paulie_D: https://movies.stackexchange.com/a/100282 (CC BY-SA 4.0).
Need it done for your business? UphillTech.