There is no such thing as an ungranted patent. A patent exists only once a patent office grants it. Until then the correct term is a patent application, a pending application, or an application for invention.
Because nothing is enforceable yet. A pending application gives you a filing date and a place in the queue, not the right to stop anyone doing anything.
Some jurisdictions grant limited provisional rights that run from the date the application publishes. These usually allow the applicant to claim reasonable compensation later, once the patent is granted, from anyone who used the invention in the meantime. They are not the same as being able to stop them at the time.
Typically three to four years between filing and grant, though it varies by jurisdiction and by how complex the case is. Objections from the examiner or requested amendments can push it to five years or more. See how long it takes to get a patent granted for what drives the timeline.
It depends on the office, and this catches people out.
In most countries patent renewal fees begin only once the patent is granted. At the European Patent Office they fall due annually while the application is still pending, and missing one can end the application before it ever becomes a patent.