KISS.
Record Wallclock time @ start of downtime, record wallclock time @ end of downtime.
Compare to get the difference, some great Date Time tools in the sample library, one specifically does what you want.
https://www.rockwellautomation.com/...ads/application-code-library/sample-code.html
+1 for KISS
One shot to record the start time and the end time. Subtract start from end and add that value to the pre-existing down time. Provide some mechanism to set the down time to zero, or hang on to daily, weekly, or monthly down time.
This will give you a microsecond value. There are some Add On Instructions for converting to HH:MM:SS if you want to do that.
Start thinking about how you will spend the big raise you will get.