Time display - updated

Hello, for a start in the world of extension building, I have built an extension that shows the time now. The problem is that it does not update … it shows me when I entered the screen what time it is, and when the time changes it still shows the time I entered the screen! How can he present the time in an updated way? This is the code:

@SimpleFunction(description = "Get the time now")
public String GetTheTimeNow() {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("HH:mm:ss");
   LocalDateTime now = LocalDateTime.now();
 return dtf.format(now);
}

Then use this function along with clock timer event… set the clock interval to 1000

Or add public void run function in extension along with event listener to get updated time

1 Like

how do I do it?

Have you added any event dispatcher ?

No … what does that mean?