Satoshi Nakamoto has integrated the halving into the BTC code. Every 210,000 blocks the miners' reward is halved. This means that deflation is predetermined for the first completely digital currency. So it will take another 120 years until the last 3 million Bitcoins are mined. In 2140 to be exact.