I am having a hard time figuring these out, it turns out that I get corrected by native speakers a lot, when I use one of them, they will correct me saying that another particle should be used instead.
大学に行く時に、もう夜なんだよ。
大学に行く時は、もう夜なんだよ。
大学に行く時には、もう夜なんだよ
At this point I am completly at lost in how different these should be, one guess would be that に should be when I wanna talk what happens in that "moment" and は when I wanna talk about that "moment" directly.
If my example is bad, please use a better one for exaplining the matter.
ps: The only related answer I found was this What is the difference between 時に and 時は but it didn't clear out much for me, honestly.