the answer to this question is very simple.

1. if you are a permanent residence (green card), then you can apply for in 5 years after you have been a permanent resident.
* 3 years if you are a permanent resident because you got married to a US citizen

that simple

but you should talk to a lawyer, because laws change of the time and maybe it law could have changed since this page was posted.