Created
June 17, 2020 16:05
-
-
Save mokumus/bdd9d4fa837345f01b35e0cd03d67f35 to your computer and use it in GitHub Desktop.
Revisions
-
mokumus created this gist
Jun 17, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal 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; }