How is time measured in the context of updates to mining difficulty?
Yes, bitcoin should not trust anyone, but it trusts itself, i.e. its own blockchain. So, when the time comes to update the difficulty (as you said, every 2016 blocks), code grabs the timestamp of this last block, and the first block in this difficulty period (block with the index of: last index - 2016).

Comparing timestamps of those 2 blocks gives us the timespan between 2016 blocks, and allows for difficulty calculation.

You can check the code for it here:
https://github.com/bitcoin/bitcoin/blob/master/src/pow.cpp#L55

actual_timespan = last_block-&gt;get_timestamp() - first_block-&gt;get_timestamp()


More information on what block timestamps are considered valid can be found here  http://en.bitcoin.it/wiki/Block_timestamp