Now I get it.
If you want the daily total energy, then what you’re doing will give a good approximation (as good as the accuracy of the emonTx combined with the sample being representative of the power between that one and the last).
If you change to the Continuous Monitoring software, the numbers you’re logging into your database every 5 s will have been derived from about 10,000 measurements inside the emonTx, but the sketch accumulates those internally anyway and sends the cumulative total so far every 10 s (by default - change it if you wish). If nothing is lost in transmission, the cumulative total at midnight less the one from 24 hours ago will match the last day’s value from your database.
This is a bit far-fetched and unlikely in practice, but if something uses a short burst of energy every 5 s and it always falls between samples of the discrete sample software, it won’t be recorded, whereas the CM software (and your electricity meter) will see and record it.
I explained how emonCMS does it, simply because most people writing here use it, and you didn’t say otherwise. In fact, you’re making exactly the same assumption - and it’s nothing to do with emonCMS, it’s derived from the way the emonTx (the old discrete sample library) works, and that’s because it was originally conceived to operate primarily from batteries - so a 200 ms sample every 10 s was a power-saving technique.