diff --git a/api/boinc_api.cpp b/api/boinc_api.cpp index 9f875154e2..d3c664b871 100644 --- a/api/boinc_api.cpp +++ b/api/boinc_api.cpp @@ -196,6 +196,7 @@ static int start_worker_signals(); char* boinc_msg_prefix(char* sbuf, int len) { char buf[256]; struct tm tm; + struct tm *tmp = &tm; int n; time_t x = time(0); @@ -204,14 +205,18 @@ char* boinc_msg_prefix(char* sbuf, int len) { return sbuf; } #ifdef _WIN32 +#ifdef __MINGW32__ + if ((tmp = localtime(&x)) == NULL) { +#else if (localtime_s(&tm, &x) == EINVAL) { +#endif #else if (localtime_r(&x, &tm) == NULL) { #endif strcpy(sbuf, "localtime() failed"); return sbuf; } - if (strftime(buf, sizeof(buf)-1, "%H:%M:%S", &tm) == 0) { + if (strftime(buf, sizeof(buf)-1, "%H:%M:%S", tmp) == 0) { strcpy(sbuf, "strftime() failed"); return sbuf; } diff --git a/checkin_notes b/checkin_notes index 33ebd5eff0..ab19df66db 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8631,3 +8631,10 @@ Charlie 6 Dec 2010 mac_installer/ postinstall postupgrade + +Bernd 7 Dec 2010 + - API: MinGWs runtime API has neither localtime_r nor localtime_s, + but it should be safe to use localtime here + + api/ + boinc_api.cpp