[poincare] Unit: define order on representatives in a way that time

addition are displayed: years + months + ... + seconds
This commit is contained in:
Émilie Feral
2020-04-29 18:12:33 +02:00
parent 5fa50ec79d
commit a248302132

View File

@@ -183,7 +183,10 @@ int UnitNode::simplificationOrderSameType(const ExpressionNode * e, bool ascendi
}
const ptrdiff_t repdiff = eNode->representative() - m_representative;
if (repdiff != 0) {
return repdiff;
/* We order representatives in the reverse order as how they're stored in
* the representatives table. This enables to sort addition of time as:
* year + month + days + hours + minutes + seconds. */
return -repdiff;
}
const ptrdiff_t prediff = eNode->prefix() - m_prefix;
return prediff;