An new app is in the pipeline to tell people exactly how much coffee they need to keep exhaustion at bay.
Scientists have created an algorithm for the US army to ensure that the sleep-deprived troops operate to maximum efficiency.
But the commercial potential hasn't been lost on top bosses who plan to license the code to developers to create a smartphone app for coffee lovers.
The algorithm suggests that someone who had five hours sleep and woke up at 6am should have their first coffee at 7am and a second at 9am to reach peak performance for the rest of the day.