Time with database connection fixed