How long until all bitcoins are generated?

The last block generated that will generate coins will be block block #6,929,999.  This block will be generated around 2139-2140, so more than 100 years in the future.  It is not a problem that will impact the network in the near future.  The total number of coins that will have been generated at the point will be 20,999,999.9769.

If the divisibility of bitcoins is increased, the number of coins will remain below 21,000,000.  The math that explains that is not important, but if you are interested, it is not too complicated.