(fmttime2822) [_WIN32]: Replace localtime_s() with localtime().
Replace _snprintf_s() with _snprintf(). These secure functions are not supported by MinGW yet.
This commit is contained in:
parent
5545eb4b0a
commit
2270ea73d8
1 changed files with 7 additions and 7 deletions
|
@ -724,22 +724,22 @@ fmttime2822(time_t t)
|
||||||
int nn;
|
int nn;
|
||||||
TIME_ZONE_INFORMATION tzi;
|
TIME_ZONE_INFORMATION tzi;
|
||||||
long time_offset;
|
long time_offset;
|
||||||
struct tm time;
|
struct tm *time;
|
||||||
|
|
||||||
localtime_s(&time, &t);
|
time = localtime(&t);
|
||||||
|
|
||||||
n = strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S", &time);
|
n = strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S", time);
|
||||||
if (CANT_HAPPEN(n == 0)) {
|
if (CANT_HAPPEN(n == 0)) {
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
GetTimeZoneInformation(&tzi);
|
GetTimeZoneInformation(&tzi);
|
||||||
time_offset = -(tzi.Bias +
|
time_offset = -(tzi.Bias +
|
||||||
(time.tm_isdst ? tzi.DaylightBias : tzi.StandardBias));
|
(time->tm_isdst ? tzi.DaylightBias : tzi.StandardBias));
|
||||||
|
|
||||||
nn = _snprintf_s(buf + n, sizeof(buf) - n, sizeof(buf) - n -1,
|
nn = _snprintf(buf + n, sizeof(buf) - n, " %+03d%02d",
|
||||||
" %+03d%02d", time_offset/60, abs(time_offset) % 60);
|
time_offset/60, abs(time_offset) % 60);
|
||||||
if (CANT_HAPPEN(nn <= 0))
|
if (CANT_HAPPEN(nn <= 0 || nn + n >= sizeof(buf)))
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
#else
|
#else
|
||||||
size_t n = strftime(buf, sizeof(buf), "%a, %d %b %Y %T %z",
|
size_t n = strftime(buf, sizeof(buf), "%a, %d %b %Y %T %z",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue