Outline of the proof: Assume by contradiction that there is no smallest period. Use first the fact that the difference between two periods is also a period to show that you can find a decreasing sequence of periods which converge to 0.
This means that for each $\delta >0$ you can find some $T$ period such that
$$0 < T <\delta$$
Now, pick $x,y$ arbitrary.
Fix $\epsilon >0$, then there exists a $\delta$ such that for all $z$ with
$$|y-z| < \delta \Rightarrow |f(y)-f(z)|<\epsilon$$
Pick some $0< T < \delta$.
Show now that there exists some $n \in \mathbb Z$ such that $|(x+nT)-y|<\delta$.
Since this is true for all $\epsilon$ we get $f(x)=f(y)$. As those are arbitrary, you are done.