Making sense of l::0(`.u.ld;d) in tick.q

Firstly I have read a previous question on this: https://community.kx.com/t5/Developer-Tools/Help-kdb-tick-mysteries/m-p/1072#M1056

I understand that 0 is a permanent handle to the console.
I understand that .u.ld is a function defined in tick.q.

 

What is d and where is it defined?
Does the fact that this is output to the console mean that we will see it on the command line when we run tick.q, or why have we output it to the console.
What does the function return and what does l get set as?
Finally what is the overall purpose of this part of the code?

Assuming you refer to the kdb-tick repo, then d is set in tick, on line 30 of tick.q. It is a snapshot of the system clock from .z.D.

Q code is easier to read than you might think. Here is the tick function with the expressions on separate lines.

 

tick:{ init; if[not min(timesym~2#key flip value@)each t;'timesym]; @[;sym;g#]each t;d::.z.D; if[l::count y;L::$“:”,y,“/”,x,10#“.”;l::ld d] }

 

Line 2 initialises some state. Line 3 signals a timesym error if its test fails. In line 4 Amend At sets the grouped attribute on the sym column in each of the tables named in global t, then global d gets set. Line 5 sets global l, either to file path y,"/",x if y is not empty, otherwise to the result of ld d.

The last expression is the control word if, which does not return a result, so the function does not return a result. (Or, to be very precise, since every function returns something, it returns the generic null.)