Reference request: Gronwall's inequality with negative sign(s) The following claim is a consequence of Gronwall's theorem

Let $x \colon [0,\infty) \to \mathbb R$ with $x(0) = 0$ be a continuously differentiable function, whose derivative satisfies
  $$ \dot x(t) \le a(t)x(t) + C$$
  with a constant $C \ge 0$ and an integrable function $a \colon [0,\infty) \to (-\infty,0]$.
  Then we have
  $$ x(t) \le tC $$

See e.g. this blog post.
Gronwall's theorem can be found in many text books; however, all those that I looked at only considered the case of nonnegative $x$ and $a$, whereas I need $x$ to be arbitrary and $a$ to be nonpositive.
Q: Is there a (standard) text book (which can be cited) that treats this general case?
 A: Here is the usual proof of (the differential form of) Gronwall's lemma. One assumes that some differentiable function $x$ is such that $$x'(t)\leqslant a(t)x(t).$$
Then one considers $A(t)=\displaystyle\int_0^ta(s)\mathrm ds$ and one notes that
$$(\mathrm e^{-A(t)}x(t))'=\mathrm e^{-A(t)}\cdot(x'(t)-a(t)x(t))\leqslant0,
$$
hence, for every $t\geqslant0$,
$$\mathrm e^{-A(t)}x(t)\leqslant\mathrm e^{-A(0)}x(0),
$$
that is,
$$
x(t)\leqslant x(0)\exp\left(\int_0^ta(s)\mathrm ds\right).
$$
This was Gronwall's lemma. Now, the task is to adapt the brilliant idea used in its proof to the setting you are interested in! Your hypotheses are that
$$
x'(t)\leqslant a(t)x(t)+C,
$$
and $x(0)=0$, hence...
A: After searching several books on ODEs I think you could refer to a stronger result, the so called comparison lemma  which appears in appendix E.4 of 
[1] W.J. Terrell, Stability and stabilization, Princeton University Press, 2009. 

Lemma E.4 [1] (Comparison Lemma) 
Suppose $w(t, u)$ is continuous on a connected open set $\Omega$ in
  $R^2$ and the scalar equation  $$\dot{u} = w(t, u)\qquad\qquad(E.3)$$ 
  has a unique solution for each initial condition $(t_0, u_0)$. If $u(t)$ is a solution of (E.3) on $[a, b]$ and $v(t)$ is a solution of the
  differential inequality  $$\dot{v}\leq w(t,v)$$  on $[a, b)$ with
  $v(a) \leq u(a)$, then   $$   v(t) \leq  u(t),\qquad a \leq t < b.$$

In your case
$$\dot{x}\leq a(t)x(t)+C\leq C$$
as $a(t)x(t)\leq 0$ for all $t$ by definition. The solution of $\dot{u}=C$ is $u(t)=u(0)+Ct$ and for $u(0)=0\geq x(0)$ the conditions of Lemma E.4 of [1] hold true and therefore
$$x(t)\leq u(t)=Ct.$$

The above analysis holds true as long as $x(t)\geq 0$ for all$t\in[0,\infty)$. 
If $x$ is negative over some intervals then the above Lemma cannot be directly applied but needs a modification. 
We consider two cases: 
a) If $x(t)<0$ then  $x(t)<0\leq Ct$  since $C\geq 0$. 
b) For $x(t)>0$ due to continuity (and starting from $0$) there exists a time instant $$t^*=\inf\{s\in[0,t):x(t^*)=0\}$$ which is the nearest time up to $t$ for which $x(t^*)=0$. Obviously $x(s)\geq 0$ for all $s\in[t^*,t]$ and we can  apply Lemma E.4 as described before in $[t^*,t]$ to prove that $$x(t)\leq C(t-t^*)\leq Ct$$
