Proving Uniform Continuity of a function I'm trying to prove the following theorem:

Let $f(x)$ be continuous in $[0,\infty]$ and let $lim_{x \to \infty}f(x)$ be finite. Then $f(x)$ is Uniformly Continuous in $[0,\infty]$.

I managed to prove that $f(x)$ is boudned in $[0,\infty]$, but I couldn't prove it's Uniformly Continuous.
Can you help me with the proof?
 A: Let $$\ell:=\lim_{x\to \infty }f(x).$$
Let $\varepsilon>0$. By definition of the limit, there is an $M>0$ such that $$|f(x)-\ell|<\varepsilon$$
if $x\geq M$. Moreover, $f$ is continuous on $[0,M]$ which is compact, and thus it's also uniformly continuous (by Heine-Cantor Theorem). So there is a $\delta>0$ s.t. $$\forall x,y\in [0,M], |x-y|<\delta\implies |f(x)-f(y)|<\varepsilon.$$
Moreover, if $x,y\geq M$, we have that
$$|f(x)-f(y)|\leq \underbrace{|f(x)-\ell|}_{<\varepsilon}+\underbrace{|f(y)-\ell|}_{<\varepsilon}<\varepsilon+\varepsilon=2\varepsilon.$$
Remember that by definition of the limit, $|f(x)-\ell|<\varepsilon$ if $x\geq M$. 
So, in particular, if $x,y\geq M$, and $|x-y|\leq \delta$, we have that $$|f(x)-f(y)|\leq 2\varepsilon$$
what prove that $f$ is uniformly continuous on $[M,\infty [$. 
Now we have that $f$ is uniformly continuous on $[0,M]$ and on $[M,\infty [$. This unfortunately don't prove (a priori) that $f$ is uniformly continuous on $[0,M]\cup [M,+\infty [=[0,+\infty [$. We have to prove that if $x\in [0,M]$, $y\in [M,\infty [$ and $|x-y|<\delta$, we still have $|f(x)-f(y)|<\varepsilon$ (or to be precise, we'll get here $|f(x)-f(y)|<3\varepsilon$, but it doesn't matter. I let you think why !).
So, let $x<M<y$ s.t. $|x-y|<\delta$. In particular, $|x-M|\leq \delta$, $|y-M|\leq \delta$ and thus $$|f(x)-f(y)|\leq \underbrace{|f(x)-f(M)|}_{\leq \varepsilon}+\underbrace{|f(M)-f(y)|}_{\leq 2\varepsilon}\leq 3\varepsilon$$
what finally prove the claim. In fact, you also have to check the result for $y<M<x$, but it's exactly the same than the case $x<M<y$. 
A: Since $f$ is continuous on $[0,\infty]$, it is a continuous function defined on a compact set, so uniform continuity is an immediate consequence. You have to be mindful of the metric you are working with, though. The usual metric on $\mathbb R$ does not extend from $[0,\infty)$ to $[0,\infty]$, if you use the metric directly, you have to find a different metric from the usual one.
