Time Tracking with Linked Issues

I have created a main issue which does not necessarily have time associated with it but I’d like to see the total time allocated to all the linked issues it has. What is the best way to accomplish something like this?

I am not aware of any function with which this would be possible. But I can see why it might be needed. Possibly the whole thing can be realized with the API?