Fix calculation of system time