Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* file serve: serve files using mmap() * add more efficient C functions for time parsing
- Loading branch information
1 parent
d2098c6
commit c643e0c
Showing
5 changed files
with
85 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <time.h> | ||
#include <locale.h> | ||
|
||
|
||
void set_c_locale() { | ||
setlocale(LC_TIME, "C"); | ||
} | ||
|
||
|
||
time_t c_parse_http_time(char* s) { | ||
struct tm dest; | ||
strptime(s, "%a, %d %b %Y %H:%M:%S GMT", &dest); | ||
return mktime(&dest); | ||
} | ||
|
||
void c_format_http_time(time_t src, char* dest) { | ||
struct tm t; | ||
gmtime_r(&src, &t); | ||
strftime(dest, 40, "%a, %d %b %Y %H:%M:%S GMT", &t); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters