Skip to content

Instantly share code, notes, and snippets.

@mokumus
Created June 17, 2020 16:05
Show Gist options
  • Select an option

  • Save mokumus/bdd9d4fa837345f01b35e0cd03d67f35 to your computer and use it in GitHub Desktop.

Select an option

Save mokumus/bdd9d4fa837345f01b35e0cd03d67f35 to your computer and use it in GitHub Desktop.

Revisions

  1. mokumus created this gist Jun 17, 2020.
    25 changes: 25 additions & 0 deletions main.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    #include <stdio.h>
    #include <time.h>
    #include <string.h>


    char * timestamp();

    #define print_log(f_, ...) printf("%s ", timestamp()), printf((f_), ##__VA_ARGS__), printf("\n")


    int main(int argc, char* argv[]) {


    print_log("Hello");
    print_log("%s%d","mokumus",1996);

    return 0;
    }

    char * timestamp(){
    time_t now = time(NULL);
    char * time = asctime(gmtime(&now));
    time[strlen(time)-1] = '\0'; // Remove \n
    return time;
    }