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 /channels/chan_skinny.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 'channels/chan_skinny.c')
-rw-r--r-- | channels/chan_skinny.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index f55002d64..31b5a5844 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -3735,21 +3735,21 @@ static int handle_line_state_req_message(struct skinny_req *req, struct skinnyse static int handle_time_date_req_message(struct skinny_req *req, struct skinnysession *s) { - time_t timer; - struct tm *cmtime; + struct timeval tv = ast_tvnow(); + struct ast_tm cmtime; if (!(req = req_alloc(sizeof(struct definetimedate_message), DEFINETIMEDATE_MESSAGE))) return -1; - timer = time(NULL); - cmtime = localtime(&timer); - req->data.definetimedate.year = htolel(cmtime->tm_year+1900); - req->data.definetimedate.month = htolel(cmtime->tm_mon+1); - req->data.definetimedate.dayofweek = htolel(cmtime->tm_wday); - req->data.definetimedate.day = htolel(cmtime->tm_mday); - req->data.definetimedate.hour = htolel(cmtime->tm_hour); - req->data.definetimedate.minute = htolel(cmtime->tm_min); - req->data.definetimedate.seconds = htolel(cmtime->tm_sec); + ast_localtime(&tv, &cmtime, NULL); + req->data.definetimedate.year = htolel(cmtime.tm_year+1900); + req->data.definetimedate.month = htolel(cmtime.tm_mon+1); + req->data.definetimedate.dayofweek = htolel(cmtime.tm_wday); + req->data.definetimedate.day = htolel(cmtime.tm_mday); + req->data.definetimedate.hour = htolel(cmtime.tm_hour); + req->data.definetimedate.minute = htolel(cmtime.tm_min); + req->data.definetimedate.seconds = htolel(cmtime.tm_sec); + req->data.definetimedate.milliseconds = htolel(cmtime.tm_usec / 1000); transmit_response(s, req); return 1; } |