Given any two positive real numbers $p_1,p_2$ and a function $f_1 : \mathbb{R} \to \mathbb{R}$ such that $f_1$ has a minimal positive period of $p_1$ . Then is it true that whatever be the choice of $f_1$ there is always a function $f_2 : \mathbb{R} \to \mathbb{R}$ having smallest positive period of $p_2$ such that the function $f_1-f_2$ is also periodic ?

A Miklos Schweitzer problem says :

Let $p_1,p_2$ be any two positive real numbers. Then prove that there is always functions $f_1,f_2 : \mathbb{R} \to \mathbb{R}$ such that $f_i$ has minimal positive period of $p_i$ and the function $f_1-f_2$ is also periodic.

In the proof the function $f_1$ was constructed as $f_1(x) = x$ for every real number $x \in [0,p_1)$ and then extended periodically on $\mathbb{R}$