The grammar is OK in both sentences, but not great in style or semantics.
"I am looking forward to getting my diploma" is a better version of both your example sentences because it conveys the same meaning and feeling without any extra words. Shorter is better.
If you want to keep the longer structure, then semantically, "I am looking forward to the moment I get my diploma". Getting a diploma is a moment, rather than a time.
"Looking forward to a time (when)..." refers to an extended time, and usually one where we don't know when or even if it will happen:
I'm looking forward to a time when I don't have to worry about finding work, and I can buy things I need without checking my bank balance.
In sum, your example about receiving your diploma is simple, about a single moment, and it has a clear time when it will happen, so it doesn't work naturally with "looking forward to a time".