Idle Game c++ get elapsed hours

I want to make an idle game were you get for example 200 $ per hour but I don’t know how to calculate the elapsed hours. You should get the money you would have earned even if the computer is off. Do you have any clue how to do that? Is there any special function for that?