diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-18 19:47:20 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-07-18 19:47:20 +0000 |
commit | 74c2948c2299773fd3816af43e06e3bdf714ba3a (patch) | |
tree | 540f82bac3e6105b6fc34cd4b4613c1756a7512b /main/http.c | |
parent | fd471b4a0cbb2abd7b4c8f30fee850cedefedaa1 (diff) |
Merge in ast_strftime branch, which changes timestamps to be accurate to the microsecond, instead of only to the second
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@75706 f38db490-d61c-443f-a65b-d21fe96a405b
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" |