David was a man of passion. God said he was a man after his own heart. When you have a heart like God , you understand things well.
He relates the struggle that was in his breast between grace and corruption, between passion and patience (v. 1-3). He meditates upon the doctrine of man’s frailty and mortality, and prays to God to instruct him in it. He applies to God for the pardon of his sons, the removal of his afflictions, and the lengthening out of his life till he was ready for death
1 I said, “I will be careful how I act and will not sin by what I say.
I will be careful what I say around wicked people.”
2 So I kept very quiet.I didn’t even say anything good,
but I became even more upset.
3 I became very angry inside,and as I thought about it, my anger burned.
So I spoke:
4 “Lord, tell me when the end will comeand how long I will live.
Let me know how long I have.
5 You have given me only a short life;my lifetime is like nothing to you.
Everyone’s life is only a breath. Selah
6 People are like shadows moving about.All their work is for nothing;
they collect things but don’t know who will get them.
He remembered the covenants he had made with God to walk circumspectly, and to be very cautious both of what he did and what he said. When at any time we are tempted to sin, and are in danger of falling into it, we must call to mind the solemn vows we have made against sin, against the particular sin we are upon the brink of. God can, and will, remind us of them (Jer. 2:20, Thou saidst, I will not transgress), and therefore we ought to remind ourselves of them. So David did here.
So the lesson here is to guard what you say and do.