Proving condition is sufficient for long term existence of ODE solution I am working on the following problem from Gerald Teschl's book on ODE's and am at a loss of how to proceed.

Suppose $U=\mathbb{R} \times \mathbb{R}^n$ and that $|f(t,x)| \leq g(|x|)$ for some positive continuous function $g \in C([0,\infty))$ which satisfies
  $$\int_0^{\infty} \frac{dr}{g(r)} = \infty$$
  Then all solutions of the IVP $f(t,x) = \dot{x}$, $x(0) = x_0$ are defined for all $t \geq 0$.
  Show that the same conclusion still holds if there is such a function $g_T(r)$ for every $t \in [0,T]$.
  (Hint: Look at the differential equation for $r(t)^2 = |x(t)|^2$.)

I am not sure how to use the hint and I have not been successful in any of my attempts at the problem.  Any help would be appreciated.  Thanks!
 A: Assume that the maximal interval of definition of the solution is $[0,T)$.
We have to prove that $T=+\infty$.
Let $r(t) = |x(t)|$ and assume for the moment that $x(t) \neq 0$ for every $t\in [0,T)$, so that $r$ is of class $C^1$ and
$$
\dot{r}(t) = \frac{\dot{x}(t) \cdot x(t)}{|x(t)|} \leq |\dot{x}(t)|
= |f(t, x(t))| \leq g(r(t)).
$$
Since $g$ is a positive function you have that
$$
\frac{\dot{r}(s)}{g(r(s))} \leq 1,
\qquad \forall s\in [0,T).
$$
Integrating this inequality on $[0,t]$ you get
$$
\int_0^t \frac{\dot{r}(s)}{g(r(s))}\, ds \leq t,
\qquad \forall t\in [0,T).
$$
The first integral can be computed with the change of variable $y = r(s)$, obtaining
$$
(1)\qquad
\int_{r_0}^{r(t)} \frac{1}{g(s)}\, ds \leq t,
\qquad \forall t\in [0,T).
$$
Assume now, by contradiction, that $T < +\infty$.
In this case you must have $r(t) = |x(t)| \to +\infty$ for $t \to T^-$.
But this is in contradiction with (1), since the l.h.s. diverges by assumption to $+\infty$ whereas the r.h.s. goes to $T$.
The assumption $x(t) \neq 0$ for every $t\in [0,T)$ is not restrictive.
Namely, since we are assuming by contradiction that $|x(t)| \to +\infty$ for $t\to T^-$, then we have that there exists some $t_0\in [0,T)$ such that $|x(t)| > 0$ for every $t\in [t_0, T)$. Now it is enough to reason as above on the interval $[t_0, T)$.
