No one can answer your question with any precision for several reasons - one of which is that you've not said how much of a load you'll be placing on the components. You can think of it this way:
component temp = ambient temp + load-induced temp
By load-induced, I mean that as the demand your applications make on CPU and GPU increase, the component temperature will increase proportionally. In other words, if the RPi sits idle, the load is small, and the temperature increase above ambient is small. On the other hand, if you have a very compute-intensive or network-traffic-intensive application, then the the temperature increase above ambient could be quite high.
There are several things you should have researched before posting your question. I will review some of them briefly here, and then you should have enough information to make a reasonable judgment, and/or formulate an approach to managing the temperature of your RPi components:
Read the RPi FAQ on Performance, and note the sub-topic on operating temperature limits and heatsink recommendations.
Another Q&A on this site has an answer that may address your question about "how long" you can run the RPi at a given temperature.
Understand how the RPi reacts when component temperatures reach their upper limit: The system will "throttle" (i.e. reduce the clock frequency) of the CPU at 80-85 degC. The RPi will not shut itself down if throttling fails to reduce the component temperature below its limit.
Understand that under a heavy load airflow over your components becomes increasingly important to maintain their temperature in a safe operating area, and un-throttled.
RPi gives you some tools to keep track of component temperatures:
- GPU (Graphics Processing Unit) temperature can be obtained using the
$ vcgencmd measure_temp
temp=45.6'C # For Example, on my system just now
- the CPU (the ARM Central Processing Unit) current temperature is stored in the file:
/sys/class/thermal/thermal_zone0/temp. It is stored as an integer value that is 103 times the value in degC; to convert to degC, you could do something like this:
$ echo $((TEMP/1000))
45 # NOTE: Value truncated
Given that you know how to read component temperature on your system, you could add this bit of code (or similar) to your code, place your system under the environmental conditions you expect, and observe what happens. This is really the only way you can begin to approach your question.
After you read and research, let us know if something is unclear to you.