The only thing you can do is treat the instantaneous flow with a form of integration, i.e. set a sample time and period grab the instantaneous flow at that time and then you have to assume it is the same over the period until you grab another sample. then just add the flow for that time period to a ongoing register. of course it's fairly inaccurate but you can't do it a better way.
if you want it to be a little more accurate grab it more often and reduce the wait period and take more samples.
Sorry, i've done this in the past and it's worked ok as a last measure but i don't have the code but it's not overly complex.