Two things come to mind:
The first is to ask what you are using to manage the smart plug. There may be options in the app you are using that could achieve this without needing to find out the running time on it's own. In a couple of the "smart" humidity apps there are settings for turning off the plug after a set period of time. Equally in RM you could manage this with waits that use a set time (or variable) to turn the plug off.
The second thing is that if you are looking to get the overall running time, there may (or may not) be something in this little app that could be useful: