1 | #include "src/picohttpparser.c" |
2 | |
3 | #if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) |
4 | #define __WINDOWS__ |
5 | #endif |
6 | |
7 | // date |
8 | #include <time.h> |
9 | |
10 | const char* get_date() { |
11 | time_t t; |
12 | struct tm tm; |
13 | static const char *days[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; |
14 | static const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; |
15 | static char date[30] = "Thu, 01 Jan 1970 00:00:00 GMT"; |
16 | |
17 | time(&t); |
18 | #ifdef __WINDOWS__ |
19 | gmtime_s(&t, &tm); |
20 | #else |
21 | gmtime_r(&t, &tm); |
22 | #endif |
23 | strftime(date, 30, "---, %d --- %Y %H:%M:%S GMT", &tm); |
24 | memcpy(date, days[tm.tm_wday], 3); |
25 | memcpy(date + 8, months[tm.tm_mon], 3); |
26 | |
27 | return date; |
28 | } |