It's not only the variable declaration that was missing, also the function parameters should change:
from
localtime_s(&tlsPtr->ltbuf, timer);
to
localtime_s(timer, buf);
Again thank you, Maurizio