Don't use strftime
This commit is contained in:
+15
-1
@@ -68,7 +68,21 @@ public:
|
|||||||
#else
|
#else
|
||||||
gmtime_r(&now, &tstruct);
|
gmtime_r(&now, &tstruct);
|
||||||
#endif
|
#endif
|
||||||
strftime(date, 32, "%a, %d %b %Y %X GMT", &tstruct);
|
static const char wday_name[][4] = {
|
||||||
|
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
|
||||||
|
};
|
||||||
|
static const char mon_name[][4] = {
|
||||||
|
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||||
|
};
|
||||||
|
sprintf(date, "%.3s, %.2d %.3s %d %.2d:%.2d:%.2d GMT",
|
||||||
|
wday_name[tstruct.tm_wday],
|
||||||
|
tstruct.tm_mday,
|
||||||
|
mon_name[tstruct.tm_mon],
|
||||||
|
1900 + tstruct.tm_year,
|
||||||
|
tstruct.tm_hour,
|
||||||
|
tstruct.tm_min,
|
||||||
|
tstruct.tm_sec);
|
||||||
}
|
}
|
||||||
|
|
||||||
char date[32];
|
char date[32];
|
||||||
|
|||||||
Reference in New Issue
Block a user