Is credit used to mean the same thing in the next two sentences?

He arrived five minutes late, but to his credit he did work an extra ten minutes at the end of his shift.

Give her credit for trying.
the same meaning