Very do-able, unfortunately I can’t share any code. Might want to output it somewhere else though if you plan to make this a permanent solution (like a csv file or something, just a suggestion).
With a little bit of URscript and a thread you should be able to achieve this.
There is also a urcap developed by the genius @jbm here Get Controller Time URcap this will give you better time stamps from the controller.
Like any PC the clock will drift over time, probably make it a weekly habit go into the UR system settings and update the clock
Someone else in the community may be able to provide better guidance or a programmed solution, anyways hope this helps get you started and best of luck!