Let $f: \mathbb R\to \mathbb R$ be a Borel measurable function. Suppose that for each $q\in \mathbb Q$, the function $f(q+x)-f(x)$ is continuous on $\mathbb R$. Is it true that there is a continuous function $g: \mathbb R\to \mathbb R$ such that $f(x)=g(x)$ for Lebesgue almost every $x\in \mathbb R$?


If the answer to the above question is negative, how about assuming in addition that $f(x+m)=f(x)$ for all $m\in 
\mathbb Z$. Namely, we ask the same question for a function defined on $\mathbb R/\mathbb Z$. 



Is a measurable solution continuous?
Consider the 1-periodic function $f$ with Fourier series $$\sum n^{-1}\cos (2\pi n! x).$$
Note that it satisfies your property, since all but finitely many summands are $h$-periodic for any rational $h$. On the other hand, if it were a Fourier series of a continuous function $F$, its partial sums would be Cesàro convergent to the values of $F$, but for $x=0$ the sum of series is infinite (both Cesàro or usual).


Well, strictly speaking the above function $f$ is defined only on a set of full measure (not pointwise) and $f(x+h)-f(x)$ is equivalent to a continuous function, but not genuine pointwise continuous. Is it ok for you? If not, you may carefully correct it on a set of measure 0. For example, define $f(x)$ as a sum of above series when it converges (by Carleson's theorem the series converges almost everywhere to the initial function). After that it remains to define the values of $f$ on the exceptional set. This exceptional set has measure 0 and is invariant under shifts by rational numbers, we must force the difference $f(x+h)-f(x)$ take the necessary values $f\_N(x+h)-f\_N(x)$, where $N$ is chosen so that $N!h$ is integer, and $f\_N$ denotes the corresponding finite sum. This is possible since these values agree in a natural sense.


