diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2019-09-15 23:35:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-15 23:35:21 +0300 |
commit | 66deb65eb5161b7d153283aecb48b4334df13786 (patch) | |
tree | 388e82c22750c3eefb4b39ac892b8fa1bbbde7e8 | |
parent | 228a39b94ff61f41f36a15ce0194dadc69dc0e36 (diff) | |
parent | ecf5774181507ceb14e56311f463e0493d739e0e (diff) |
Merge pull request #5 from Pranjalya/master
Update file_spec.h
-rw-r--r-- | GIZA++-v2/file_spec.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/GIZA++-v2/file_spec.h b/GIZA++-v2/file_spec.h index a8a1630..54fbb25 100644 --- a/GIZA++-v2/file_spec.h +++ b/GIZA++-v2/file_spec.h @@ -34,20 +34,19 @@ USA. editions for C++ and formatting by Noah A. Smith, 9 July 1999 */ char *Get_File_Spec (){ - struct tm *local; - time_t t; - const char *user; - char time_stmp[19]; - char *file_spec = 0; - - t = time(NULL); - local = localtime(&t); - - sprintf(time_stmp, "%02d-%02d-%02d.%02d%02d%02d.", local->tm_year, - (local->tm_mon + 1), local->tm_mday, local->tm_hour, - local->tm_min, local->tm_sec); - user = getenv("USER"); - if (!user) { user = "no_user"; } + struct tm *local; + time_t t; + char *user; + char time_stmp[19]; + char *file_spec = 0; + + t = time(NULL); + local = localtime(&t); + + sprintf(time_stmp, "%04d-%02d-%02d.%02d%02d%02d.", 1900 + local->tm_year, + (local->tm_mon + 1), local->tm_mday, local->tm_hour, + local->tm_min, local->tm_sec); + user = getenv("USER"); file_spec = (char *)malloc(sizeof(char) * (strlen(time_stmp) + strlen(user) + 1)); |