One possible solution could be to use a Functional Global Variable (FGV) design pattern. This implementation computes the time difference, in each iteration, between the elapsed time and the initial time. When this difference is equal or greater than the target time, the VI stops.
However, FGVs are used as SubVI, therefore you have to implement a main VI that executes the FGV, as can be in the following image.
The control Required Time
is in seconds, therefore, if you are using hours you should perform the following conversion:
Hours = Seconds × 60 × 60