#$restime is called from the database, which is the previos total. ...snip... $current_time = time(); $res_time = $logtime - $current_time; $newtime = $res_time+$stime; ...snip... #I then update the database by inserting new time, next time the number will grow again etc..