It is definitely right! But it seems like something you would read in a book. In my daily life, I would change the order.
"Time goes fast when I read books."
"Time goes by fast when I read books."
Or instead of saying "when I read books" you could say "when I'm reading."
"Time goes by fast while/when I'm reading."
I hope that is helpful! Send me a message or something if you need anymore help!