Upgrade for calculating time