It all depends on your specific situation. If when you first came in you did not do so totally legally (i.e., on a legal passport and/or through the UN refugee commission or similar) the government will not count any time that you did not have full legal status towards the five years legal residency you need for ILR. If you were away from the UK for any lengthy period they will also discount any time before those times away also (the exact length of time away allowed is on the Home Office Web site).
I would advise you to see a Citizens Advice Bureau or refugee organisation that can provide you with legal help. I would not trust some of the lawyers/"legal advisors" who advertise in the ethnic minority press--you can get free help with issues like these from trustworthy organisations. If your case is really complicated, the free advisor might suggest that you need help from a lawyer though. If so, choose carefully...
And I should quickly say that I am NOT a lawyer--just another immigrant trying to figure out this crazy system.
Good luck!