California Penal Code §4019 provides for two days of credit for every four days actually served. This works to about two thirds.
Some counties release people early due to overcrowding. Others offer a "kick" for good behavior, releasing people a few days early if they stay out of trouble in jail.
If someone is sentenced to state prison for a violent felony, they only get fifteen percent credit for the jail time they served prior to the prison commitment.
Please understand that this is a general discussion of legal principles by a California lawyer and does not create an attorney/client relationship. It's impossible to give detailed, accurate advice based on a few sentences on a website (and you shouldn't provide too much specific information about your legal matter on a public forum like Avvo, anyway). You should always seek advice from an attorney licensed in your jurisdiction who can give you an informed opinion after reviewing all of the relevant information.
I agree with Attorney Marshall's answer and would add that there is a minimum before the good time credit begins...usually between 6 and 9 days depending on your county for jail time (not prison time).
You get one day's credit for every two you actually serve. Then, because of budgetary considerations, they usually release you earlier than that, because they can't afford to keep everybody for their full sentences. The "kick-out date" varies with your crime. Ordinary drunk drivers, for example, are sometimes booked and released. (Bear in mind that the book-and-release process takes about twelve hours.)
Ask your lawyer for advice on this subject.
Most counties have early-release policies to reduce jail overcrowding, greater than the legal guidelines. It varies from county to county, and even at different times in the same county due to crowding conditions. Orange County inmates usually serve two-thirds of their sentence. Los Angeles County inmates sometimes serve as little as ten per cent. You can often call the particular jail and ask what their policy is at a given time.
The percentage in LA County has recently changed to 15% for most crimes, and Orange County is going to 50%. The law has changed to 50% on prison sentences generally. Each of these guidelines can change, however, depending on the crime and circumstances.