diff --git a/src/glog.c b/src/glog.c new file mode 100644 index 0000000..efded3a --- /dev/null +++ b/src/glog.c @@ -0,0 +1,29 @@ +#include +#include + +int glog(char *s) { + time_t timer; + char buffer[26]; + struct tm* tm_info; + + time(&timer); + tm_info = localtime(&timer); + + strftime(buffer, 26, "%Y-%m-%d %H:%M:%S", tm_info); + printf("%s - %s\n", buffer, s); + + return 0; +} + +// only print partial, interim solution for not supporting printf style calling +void gloghead() { + time_t timer; + char buffer[26]; + struct tm* tm_info; + + time(&timer); + tm_info = localtime(&timer); + + strftime(buffer, 26, "%Y-%m-%d %H:%M:%S", tm_info); + printf("%s - ", buffer); +} diff --git a/src/glog.h b/src/glog.h new file mode 100644 index 0000000..b78f999 --- /dev/null +++ b/src/glog.h @@ -0,0 +1,2 @@ +int glog(char *s); +void gloghead();