Does "time" mean the same thing in these two sentences?

We had a wonderful time at the party.

He is not living at home because he is doing time.
different meanings