John Gill's Exposition of the Whole Bible
Psalms 119:62
At midnight I will rise to give thanks unto thee,.... Not only send up an ejaculatory thanksgiving upon his bed, but rise up from it and shake off his sleep, and in a set, serious, solemn manner, praise the Lord. This shows a great regard to him, and affection to this work, since it is with difficulty men prevail upon themselves to rise at midnight upon any occasion; at midnight Paul and Silas prayed and sung praises to God, Acts 16:25;
because of thy righteous judgments; upon the wicked, as Aben Ezra; the hands and troops of them that encompassed him about, and robbed him; but God avenged him of them, and for this he gave thanks, or for such like things. Sometimes the judgments of God have been executed at midnight; as the destruction of the firstborn in Egypt, and of Pharaoh and his host in the Red sea, when Israel sang his praise,
Exodus 12:29; and for the judgments of God upon antichrist the church will rejoice and give thanks, Revelation 18:20. Or rather by these may be meant the word of God, the precepts and ordinances of it, which are all just and good; such is the law of God, and such are the ordinances of Christ, Psalms 19:9.