Is the word "time" used in the same way in the following two sentences?

We had a wonderful time at the party.

The judge leniently granted a sentence with no hard time.
different meanings