core: replace localtime() with reentrant localtime_r()

fixes #4682
tests: add special icinga2 command argument macros