I guess the problem is when the time is in hh:mm:ss format?
If that's the problem note that a minute is 1/60 of an hour, so if you had 2h 34 min, you would add up 34 times the 1/60 part of an hour i.e.
If you had seconds then you would do a similar thing as seconds are 1/60 of a minute, i.e. 1/3600 of an hour. e.g.
And of course, after you transform the hours into decimal form then you just calculate your usual percentage (y/x).