Psalm18 Uncomfortable Comfort

“The LORD has rewarded me according to my righteousness, According to the cleanness of my hands.” I am not able to say this, and I doubt anyone can. I have not “kept the ways of the LORD,” I have not been “blameless with Him.” Can I ask for the same deliverence as the David? What’s more, when could David pray this prayer truthfully?