Is there a way to get today's earnings in real-time?

Had a look into that, but I think I was too unclear in what I wanted to know:

I want to show an estimation of the earnings from the current day, but not what has been paid so far, more what the today’s traffic might have as an impact to the current months estimated earning.

@striker43 is using it for his widget, labelled as “today”: GitHub - striker43/storjWidget

I could follow the source code to understand, how the estimated payout of the current month (“estimatedPayoutTotal”) is summed up, but I don’t understand, how the “today” number is calculated (in his code it’s labeled as “estimatedPayoutToday”).

I thought about storing the today’s “estimatedPayoutTotal” into a file one minute before midnight UTC in order to have a base value for a calculation on the following day and I would output the difference to the value stored on the previous day as estimatedPayoutToday. I was wondering, if that is the only way to do so or if it might be easier.