Is it possible to insert a running clock in a Calc spreadsheet cell?

Is it possible to insert a running clock in a Calc spreadsheet cell? Digital or Analog are both usable.

Hello @Super_C,

Yes in theory, you could make a threaded timer in Python with an interval of 1 second, then update the value in your Calc cell to the current time. ( i have not tried this myself yet ).

There is a way to do it without macros, that I did a time ago for a question in the Spanish AOo forum.

In a cell introduce =NOW(), give a name to it like ‘timer’.
Save the file.
Select the cell where to introduce the clock.
Create a Menu/Sheet/Link to external data, select as data source the own file.
Select the ‘timer’ in the ‘Available Tables/Ranges’
Mark Update interval and fix the seconds you like for update the clock.
Ok

Sample timer.ods|attachment

+1 awesome trick!

One disadvantage is that it stops working if the file is renamed, whereas a macro would not have this problem. However, avoiding macros is an advantage, so it’s a tradeoff. Anyway, I did not realize before that this solution can work even with reference to the same file.

As @librebel mentioned, one way to do this is with a threaded Python macro. From my answer at https://stackoverflow.com/a/44988206/5100564:

Assign keep_recalculating_thread to the Open Document event.

import time
from threading import Thread
import uno

def keep_recalculating_thread(action_event=None):
    t = Thread(target = keep_recalculating)
    t.start()

def keep_recalculating():
    oDoc = XSCRIPTCONTEXT.getDocument()
    while hasattr(oDoc, 'calculateAll'):
        oDoc.calculateAll()
        time.sleep(5)

g_exportedScripts = keep_recalculating_thread,

Instead of calculateAll(), I also tried updating a single cell containing NOW() as recommended here. My hope was that only a single cell would need to be changed.

oCell.setFormula(oCell.getFormula() + " ")

This worked too, but it made all cells with NOW() and RAND() change anyway, so it does not seem to be any more efficient. See Recalculate - LibreOffice Help.