You can also achieve that using variations.
E.g. you set some base price for your product (let’s say $100).
Then add variation for the duration:
1 hour + $50
2 hours + $100
10 hours + $800 (some kind of a discount)
This way your customer can choose how many hours he\she wants to purchase.