ok, I'll take another stab at this for you. It formats properly to your YYYYMMDD:HHMMSS on mine.
in your file at the top,
#include <time.h>
in your function try
time_t t = time(NULL);
struct tm tm = *localtime(&t);
when your ready to print it
printf("%04d%02d%02d:%02d%02d%02d",tm.tm_year+1900,tm.tm_mon+1,tm.tm_mday,tm.tm_hour,tm.tm_min,tm.tm_sec);