C program to define macro PRINTF for printf , where in PRINTF takes same arguments as printf and also prints timestamp

neelkanth_surekha# cat printf.c

#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

#define LOG_INIT()              time_t ltime; /* calendar time */ \
                                char *ptr;\

#define PRINTF(...)     ltime = time(NULL); /* get current cal time */ \
                                ptr = asctime( localtime(&ltime));\
                                ptr[strlen(ptr)-1] = '\0';\
                                printf("%s: ", ptr); \
                                printf(__VA_ARGS__); printf("\n");


void print_logs()
{
   LOG_INIT();
   PRINTF("%s", "neelu");
   sleep(2);
   PRINTF("%s", "peelu");
   sleep(2);
   PRINTF("%s", "meelu");
}


void main()
{
    print_logs();

}

Output:

neelkanth_surekha#./a.out 
Thu Nov 23 00:29:32 2017: neelu
Thu Nov 23 00:29:34 2017: peelu
Thu Nov 23 00:29:36 2017: meelu