
5 Mar
2010
5 Mar
'10
12:05 p.m.
What I'm currently doing is computing the proportions via
time_duration::total_*()
which works fine, but leads to some coding effort, since I'll have to cast one result to a real number to avoid integer division and some checks to prevent /0.
Well, you can do all this work once - in the overloaded operator :). Note that you also have to handle special cases like pos_infinity, neg_infinity, and some interesting situations like pos_infinity/pos_infinity, pos_infinity/neg_infinity etc.