Well, time doesn't enter into the equation in the sense we know it this side of the Great Beyond. So, the matter centers on both whatever guilt remains for unabsolved and/or unrepented venial sins and the balance due on the unpaid debt of sin unique to each individual soul.
The degree of perfection of individual contrition, absolute sorrow for all sins, willing submission to the pains, penalties and sorrows of one's death, the obtainment of indulgences, the intercessions of the Saints and good souls still in this life, Masses, fasting and penances offered for particular souls, etc. may also affect the sentence - IF God so permits.
He is not obligated in strict Justice to do so, of course. Nevertheless, the degree of charity achieved and exercised by the deceased and those interceding for his swift delivery from the torments of Purgatory, can obtain, God permitting, relief.
Romano Amerio has a solid section on the long-overlooked reality of the very matter of salvation and its absolute dependence on the state of one's soul AT THE PRECISE MOMENT OF DEATH. From that, obviously, flow all consequences of sins committed prior to that instant. Amerio points out that the image of a balance in which good and bad deeds are weighed throughout the life of one's soul is entirely UNCATHOLIC.
Our Lady informed Lucia at Fatima that a teenage friend would be in Purgatory until the end of time. Many, many Masses were offered for her and yet there was never any indication after the announcement from Heaven of that sentence that it was ever ameliorated or reduced or cancelled.
As well, I've read, and I wish I could recall if it was a Saint or a spiritual writer of some note, that the usual sentence in Purgatory for Carmelite nuns is forty years.
Considering St. Thomas' teaching that the agonies of Purgatory are so much more intense than all the sufferings imaginable in this life, and the very great likelihood that almost everyone not sent to Hell will spend a very, very long time there, compared to a Carmelite nun who spent 40, 50, perhaps 60 or more years living a consecrated life of strict obedience, silence, prayer, penance, abstinence and intense fasting, what we decide to do about that stark, irreversible and absolutely inevitable reality does take on a much greater significance than almost anyone can imagine.