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
This commit is contained in:
Tilghman Lesher
2007-07-18 19:47:20 +00:00
parent b96fde308c
commit 81bc1d7af5
40 changed files with 701 additions and 654 deletions

View File

@@ -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"