When does the condition $f(x+1)-f(x)=k$ for all $x$ imply that $f$ is linear? My problem is pretty straight-forward to state, but for the sake of completeness, I'll give a short explanation of how it appeared.
I came across a solution to problem 1 of IMO 2019 on Youtube. The problem is:

Find all functions $f\colon\mathbb{Z}\rightarrow\mathbb{Z}$, such that $f(2a)+2f(b)=f(f(a+b))$ for all $a,b\in\mathbb{Z}$.

The solution goes as follows:
First put $a=0$. Then for all $b$, we have
$$f(0)+2f(b) = f(f(b)).$$
Second put $a=1$. Then for all $b$,
$$f(2)+2f(b) = f(f(b+1)).$$
Use the first equation with $b+1$ in the second equation, i.e. by the first equation, we have $f(0)+2f(b+1)=f(f(b+1))$, so 
$$f(2) +2f(b) = f(0)+2f(b+1),$$
or
$$\frac{f(2)-f(0)}{2} = f(b+1)-f(b)$$
for all $b\in\mathbb{Z}$.
Since the increments are constant, it follows that $f$ is linear. You can plug a linear expression into the original functional equation to check what fits.
My question is this: If we had instead had a real function $f$, and came to the conclusion that
$$f(x+1)-f(x)=k$$
for all $x$ and some constant $k$, are there any necessary or sufficient conditions that I can impose on $f$ to make $f$ linear? Without any further restrictions, all I can say is that for any real number $r\in [0,1)$, and for any integer $n\in\mathbb{Z}$, we have
$$f(n+r) = an+f(r) = a(n+r) + (f(r)-ar),$$
and $f(r)-ar$ might be different from $f(0)$.
Source: The video in question is this one.
 A: Take$$f(x)=\begin{cases}1&\text{ if }x\in\mathbb Z\\0&\text{ otherwise.}\end{cases}$$Then $(\forall x\in\mathbb R):f(x+1)-f(x)=0$. However, $f$ is not linear.
A: You can define any function you like on an interval of length $1$ and then extend it using your $k$ by using the functional relation:
$$f(x+1)=f(x)+k.$$
Inside the given interval, you of course won't have any linearity whatsoever
A: I'll give you a continuous Example:
$$f(x)=|\sin (\pi x)|.$$
In general, you just need a periodic function, with period 1, and that will satisfy your equation with $k=0$.
A: Any function
$$
f(x) = k x +\Phi(x)
$$
with $\Phi(x)$ periodic with period $1$ is a solution. For instance 
$$
f(x) = k x + \sin(2\pi x)
$$
is such a function and $f(x)$ is not linear.
A: If we consider $x=\left \lfloor x \right \rfloor + \left \{ x \right \}$ and $x>0$ then
$$f(x)-f(\left \{ x \right \})=
f(\left \lfloor x \right \rfloor + \left \{ x \right \})-f(\left \{ x \right \})=\\
f(\left \lfloor x \right \rfloor + \left \{ x \right \})-
f(\left \lfloor x \right \rfloor -1 + \left \{ x \right \})+
f(\left \lfloor x \right \rfloor-1+\left\{ x \right \})-
f(\left \{ x \right \})=\\
k+f(\left \lfloor x \right \rfloor-1+\left\{ x \right \})-
f(\left \{ x \right \})=\\
2k+f(\left \lfloor x \right \rfloor-2+\left\{ x \right \})-
f(\left \{ x \right \})=...=
\left \lfloor x \right \rfloor k$$
or
$$f(x)=\left \lfloor x \right \rfloor k + f(\left \{ x \right \}) \tag{1}$$
At this point it becomes obvious that 

$f(x)$ is linear in $\mathbb{R} \iff f(x)$ is linear in $[0,1)$ with $k$ as the slope.

$\Leftarrow$ Obviously, if $f(x)$ is linear in $[0,1)$ with $k$ as the slope, i.e. $f(x)=kx+b, x\in[0,1)$, then 
$$f(x)=\left \lfloor x \right \rfloor k + f(\left \{ x \right \}) =
\left \lfloor x \right \rfloor k + \left \{ x \right \}k+b=
(\left \lfloor x \right \rfloor+\left \{ x \right \})k+b=\\
xk+b, x\in\mathbb{R}$$
$\Rightarrow$ Now, if $f(x)$ is linear in $\mathbb{R}$ or $f(x)=ax+b$, then from $(1)$
$$f(1)=k+f(0) \tag{2}$$
and
$$f(0)=a\cdot 0+b=b$$
and $f(1)=a+b$ and $f(1)=k+b$ or $k=a$ and result follows.
