Skip to content

Commit c8229b5

Browse files
committed
Don't use strftime
1 parent 8a57fd0 commit c8229b5

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/LoopData.h

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,21 @@ struct alignas(16) LoopData {
6868
#else
6969
gmtime_r(&now, &tstruct);
7070
#endif
71-
strftime(date, 32, "%a, %d %b %Y %X GMT", &tstruct);
71+
static const char wday_name[][4] = {
72+
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
73+
};
74+
static const char mon_name[][4] = {
75+
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
76+
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
77+
};
78+
sprintf(date, "%.3s, %.2d %.3s %d %.2d:%.2d:%.2d GMT",
79+
wday_name[tstruct.tm_wday],
80+
tstruct.tm_mday,
81+
mon_name[tstruct.tm_mon],
82+
1900 + tstruct.tm_year,
83+
tstruct.tm_hour,
84+
tstruct.tm_min,
85+
tstruct.tm_sec);
7286
}
7387

7488
char date[32];

0 commit comments

Comments
 (0)