diff options
author | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-07-18 19:47:20 +0000 |
---|---|---|
committer | Tilghman Lesher <tilghman@meg.abyt.es> | 2007-07-18 19:47:20 +0000 |
commit | 81bc1d7af5886089bcd065382476f202ad7cc9ea (patch) | |
tree | 540f82bac3e6105b6fc34cd4b4613c1756a7512b /main/http.c | |
parent | b96fde308cd75eb17e5fdb0ea6d54c0f1f593ff9 (diff) |
Merge in ast_strftime branch, which changes timestamps to be accurate to the microsecond, instead of only to the second
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75706 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/http.c')
-rw-r--r-- | main/http.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/main/http.c b/main/http.c index d8471740c..b61858cde 100644 --- a/main/http.c +++ b/main/http.c @@ -154,8 +154,9 @@ static struct ast_str *static_callback(struct server_instance *ser, const char * struct stat st; int len; int fd; - time_t t; + struct timeval tv = ast_tvnow(); char buf[256]; + struct ast_tm tm; /* Yuck. I'm not really sold on this, but if you don't deliver static content it makes your configuration substantially more challenging, but this seems like a rather irritating feature creep on Asterisk. */ @@ -186,8 +187,7 @@ static struct ast_str *static_callback(struct server_instance *ser, const char * if (fd < 0) goto out403; - time(&t); - strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&t)); + ast_strftime(buf, sizeof(buf), "%a, %d %b %Y %H:%M:%S %Z", ast_localtime(&tv, &tm, "GMT")); fprintf(ser->f, "HTTP/1.1 200 OK\r\n" "Server: Asterisk/%s\r\n" "Date: %s\r\n" @@ -843,10 +843,11 @@ static void *httpd_helper_thread(void *data) ast_variables_destroy(vars); if (out) { - time_t t = time(NULL); + struct timeval tv = ast_tvnow(); char timebuf[256]; + struct ast_tm tm; - strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S GMT", gmtime(&t)); + ast_strftime(timebuf, sizeof(timebuf), "%a, %d %b %Y %H:%M:%S %Z", ast_localtime(&tv, &tm, "GMT")); fprintf(ser->f, "HTTP/1.1 %d %s\r\n" "Server: Asterisk/%s\r\n" "Date: %s\r\n" |