Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Americans with HIV are getting diagnosed faster than ever before, but most people who are infected carry the virus for years before they know it.

On average, people infected with the AIDS virus go three years before they are tested and told about it, the Centers for Disease Control and Prevention reported Tuesday.

That’s three years during which the virus is eroding away at their immune systems, leaving them vulnerable to other infections — and three years during which they can infect others without even knowing it.

But it’s still an improvement, the CDC team said. In 2011, people went an average of three years and seven months before they got a test and diagnosis.

Paul Cheung / CDC

“These findings are more encouraging signs that the tide continues to turn on our nation’s HIV epidemic,” said CDC Director Dr. Brenda Fitzgerald. “HIV is being diagnosed more quickly, the number of people who have the virus under control is up, and annual infections are down.”

But three years is still too long and this gap between infection and detection is helping keep the virus in circulation, the CDC said.

“Ideally, HIV is diagnosed within months of infection, rather than years later,” said Dr. Eugene McCray, director of CDC’s Division of HIV/AIDS Prevention.

Related: Study confirms vaginal ring protects women from HIV

About 1.1 million Americans are infected with the human immunodeficiency virus (HIV) that causes AIDS. Thanks to better testing, about 85 percent of them know it, and nearly half, 49 percent, have the virus under control with drugs.

"40 percent of HIV infections in the United States are inadvertently, unknowingly being transmitted by persons who don’t know they have HIV."

There’s no cure for HIV and no vaccine on the market yet, but increasingly simplified drug cocktails – some as simple as a single daily pill — can control the virus so that it cannot be easily detected in the blood, doesn’t make people sick and makes it almost impossible to transmit to others.

Some groups go even longer than three years. For heterosexual men, it takes on average five years to get tested and diagnosed, in part because straight men don’t think they are at high risk.

“Fifty percent of persons with HIV infection diagnosed in 2015 had been infected for at least three years, and a quarter had been infected for more than seven years,” the CDC team wrote in their report.

Whites are tested on average after two years, African-Americans get tested on average three years after infection and Asian-Americans don’t get diagnosed until they’ve been infected for four years on average.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

They’re not only missing out on treatment — they are often infecting others.

Related: Charlie Sheen has HIV but his chances are good

“It’s 40 percent of HIV infections in the United States (that) are inadvertently, unknowingly being transmitted by persons who don’t know they have HIV,” the CDC’s Dr. Jonathan Mermin told reporters.

“Nine out of 10 HIV infections are transmitted by people who are not diagnosed or not in care,” the CDC adds on its website.

The way CDC calculates that is by looking at how much damage has been done to patients’ immune systems when they finally are tested. The virus attacks immune cells called CD4 T-cells, and blood tests measure both how much virus is in a patient’s blood and how many of these crucial T-cells have been destroyed.

What’s helping get more people tested? Quick, on-the-spot tests have made a big difference, said Rama Keita, Community Health Educator at Washington, D.C.’s Whitman-Walker Health.

“We went from people having to wait 20 minutes to get their results to just having to wait 60 seconds,” Keita said.

Clinics and advocacy groups have also stepped up active efforts to get people tested, Keita said. “We go where the clubs are,” she said. Mobile units offer quick testing in communities with a higher-risk population.

But it will take more than that to reach straight men, Asian-Americans and others who may not realize they’re at risk. Straight men, for example, are less likely to walk into a mobile HIV testing van.

“They think, ‘I don’t want to be labeled as a member of the LGBT community. I don’t want to go into Whitman Walker’,” Keita said. “That mentality will keep you from coming in and getting tested.”

And that’s a shame, said Carl Corbin, a Whitman-Walker patient and volunteer who tested HIV positive in the early 1980s, at the start of the HIV epidemic. “All of my friends were dying all around me,” Corbin said.

Related: HIV epidemic started in New York

“I was saying to myself, 'I am not going to live another year'. I have lived 30-some years.”

But even though people lose hope when they hear they have an incurable disease, HIV can be managed with the many available drugs on the market.

Now 61, Corbin is healthy and has no detectable virus in his blood.

"It should be as routine as a cholesterol test."

“I advise every human being to get tested. There is so much help out here for you,” he said.

While some groups are at more risk than others, anyone could become infected. The CDC recommends that almost everyone be tested for HIV at some point.

“If you are having sex you are at risk. It’s a sexually transmitted disease,” Keita said.

“We know infidelity occurs. Sometimes things happen.”

The best result would be if men and women alike were tested routinely as part of a doctor visit, said Mermin. But 70 percent of people at high risk who were surveyed by CDC and who had not been tested said they'd been to a doctor in the past year.

"We don't want to burden people with having to think of themselves as being at risk of HIV," Mermin said. "It should be as routine as a cholesterol test."

Those most at risk include gay and bisexual men, their sex partners, and injecting drug users. But any kind of sex can transmit the virus, as can the use of shared needles.

“Get tested. Know your status,” advises Corbin. “Because getting tested and knowing your status will save your life. If you are sexually active in the world today, you are at risk, because it is not a gay disease.”