diff options
author | Indrajith K L | 2022-12-03 17:00:20 +0530 |
---|---|---|
committer | Indrajith K L | 2022-12-03 17:00:20 +0530 |
commit | f5c4671bfbad96bf346bd7e9a21fc4317b4959df (patch) | |
tree | 2764fc62da58f2ba8da7ed341643fc359873142f /v_windows/v/thirdparty/picohttpparser/picohttpparser.c | |
download | cli-tools-windows-master.tar.gz cli-tools-windows-master.tar.bz2 cli-tools-windows-master.zip |
Diffstat (limited to 'v_windows/v/thirdparty/picohttpparser/picohttpparser.c')
-rw-r--r-- | v_windows/v/thirdparty/picohttpparser/picohttpparser.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/v_windows/v/thirdparty/picohttpparser/picohttpparser.c b/v_windows/v/thirdparty/picohttpparser/picohttpparser.c new file mode 100644 index 0000000..7a6abd0 --- /dev/null +++ b/v_windows/v/thirdparty/picohttpparser/picohttpparser.c @@ -0,0 +1,28 @@ +#include "src/picohttpparser.c" + +#if !defined(__WINDOWS__) && (defined(WIN32) || defined(WIN64) || defined(_MSC_VER) || defined(_WIN32)) +#define __WINDOWS__ +#endif + +// date +#include <time.h> + +const char* get_date() { + time_t t; + struct tm tm; + static const char *days[] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; + static const char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; + static char date[30] = "Thu, 01 Jan 1970 00:00:00 GMT"; + + time(&t); + #ifdef __WINDOWS__ + gmtime_s(&t, &tm); + #else + gmtime_r(&t, &tm); + #endif + strftime(date, 30, "---, %d --- %Y %H:%M:%S GMT", &tm); + memcpy(date, days[tm.tm_wday], 3); + memcpy(date + 8, months[tm.tm_mon], 3); + + return date; +} |