Getting Klipper timcode in realtime

Basic Information:

Printer Model: not important
MCU / Printerboard: not important
Host / SBC: not important
klippy.log: none provided

I’m no programmer at all. Can anybody help me getting the variable from Klipper in realtime which comes after “Stats” in every klippy.log. E.g.

image

I think this variable reflects the time in seconds when Host / SBC was last started.

Could the name be “ptime”? See klipper/klippy/extras/statistics.py at master · Klipper3d/klipper · GitHub

Thank you.

I’m not sure what you are asking.
In my head, ptime is either print_time or process time, depending on the context.

It is a monotonic (eventtime) time (Code overview - Klipper documentation):

Where ptime is simply CPU usage in the code: ptime = time.process_time() klipper/klippy/extras/statistics.py at master · Klipper3d/klipper · GitHub

Hope that helps,
-Timofey

Thank you Timofey for your quick reply,

ptime was just the result of my resarch (no programmer at all).

My question is, how to get this variable?

image

What is “2948.6”?

AFAIK, there is no way to get the current time in the macro (like any time)

What is “2948.6”?

It is a monotonic time; normally, it represents the number of seconds since the host’s bootup.
Normally, one should only care that they happen regularly (exactly every 1 second in the log).

I understand, but it is “just” software. There must be a way to get that variable!

Thank you.

You can’t get it inside the macro in normal way, in the code it is reactor.get_monotonic()