How to correct the calling interval for a function with p:poll?
<p>I'm developing an application that shows a clock to the user in order to control the execution time for tasks and log. The clock should have the server hour so it can't be modified by the user.</p>

<p>The problem is that when the time runs, the <code>actualizarTiempo</code> function each time executes in larger intervals, making the clock look like the image below.</p>

<p><a href="https://i.stack.imgur.com/5usFN.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5usFN.gif" alt=""></a></p>

<p>What can I do to guarantee that the <code>actualizarTiempo</code> function executes each second in an indefinite manner?</p>

<p>My Java Code:</p>

<pre><code>package bean.controlador;

import java.io.IOException;
import static java.lang.Thread.sleep;
import java.util.Calendar;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

@ManagedBean
@SessionScoped
public class Calendario {
    Calendar calendario;
    String tiempo;
    public Calendario() {
    }
    public void load() throws IOException, InterruptedException{
        actualizarTiempo();
        FacesContext.getCurrentInstance().getExternalContext().redirect("registroActividades.xhtml");
    }

    public void actualizarTiempo() throws InterruptedException{
        calendario = Calendar.getInstance();
        tiempo = Integer.toString(calendario.get(Calendar.HOUR_OF_DAY)) + ":" +Integer.toString(calendario.get(Calendar.MINUTE)) + ":" + Integer.toString(calendario.get(Calendar.SECOND));
    }

    public Calendar getCalendario() {
        return calendario;
    }

    public void setCalendario(Calendar calendario) {
        this.calendario = calendario;
    }

    public String getTiempo() {
        return tiempo;
    }

    public void setTiempo(String tiempo) {
        this.tiempo = tiempo;
    }

}
</code></pre>

<p>My XHTML code:</p>

<pre><code>&lt;h:panelGroup id = "panelNuevo"&gt;
    &lt;h:outputText value = "#{calendario.tiempo}"/&gt;
&lt;/h:panelGroup&gt;
&lt;h:form&gt;
    &lt;p:poll interval="1" listener="#{calendario.actualizarTiempo}" update=":panelNuevo" /&gt;
&lt;/h:form&gt;
</code></pre>

<p>Thank you!</p>