Suppose $F$ is a primitive of $f$. Since $f$ is continuous on $\mathbb{R}\setminus \{0\}$, we have
$$F(y) - F(x) = \int_x^y f(t)\,dt$$
for $0 < x < y$ or $x < y < 0$ by the fundamental theorem of calculus. The continuity of $F$ then forces
$$F(x) = F(0) + \int_0^x \sin \frac{1}{t}\,dt$$
for all $x\in \mathbb{R}$. Thus it remains to see that $F$ is differentiable at $0$ with derivative $0$. Now we have
$$\frac{d}{dt}\bigl(t^2\cos (t^{-1})\bigr) = \sin (t^{-1}) + 2t\cos (t^{-1})$$
and so
$$\int_0^x \sin (t^{-1})\,dt = \int_0^x \frac{d}{dt}\bigl(t^2\cos (t^{-1})\bigr) - 2t\cos (t^{-1})\,dt = x^2\cos(x^{-1}) - \int_0^x 2t\cos (t^{-1})\,dt.$$
The first part $x^2\cos (x^{-1})$ is easily seen to be differentiable at $0$ with derivative $0$ there, and since
$$g(t) = \begin{cases} 0 &, t = 0 \\ 2t\cos (t^{-1}) &, t \neq 0 \end{cases}$$
is continuous on all of $\mathbb{R}$, the fundamental theorem of calculus asserts its differentiability on $\mathbb{R}$, and the derivative is $g$. Hence
$$F'(0) = 0 - g(0) = 0.$$