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/misdn | |
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/misdn')
-rw-r--r-- | channels/misdn/ie.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/channels/misdn/ie.c b/channels/misdn/ie.c index 4093805b5..e7133ca75 100644 --- a/channels/misdn/ie.c +++ b/channels/misdn/ie.c @@ -852,17 +852,11 @@ static void enc_ie_date(unsigned char **ntmode, msg_t *msg, time_t ti, int nt, s unsigned char *p; Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN); int l; + struct timeval tv = { ti, 0 }; + struct ast_tm tm; - struct tm *tm; - - tm = localtime(&ti); - if (!tm) - { - printf("%s: ERROR: gettimeofday() returned NULL.\n", __FUNCTION__); - return; - } - - if (MISDN_IE_DEBG) printf(" year=%d month=%d day=%d hour=%d minute=%d\n", tm->tm_year%100, tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min); + ast_localtime(&tv, &tm, NULL); + if (MISDN_IE_DEBG) printf(" year=%d month=%d day=%d hour=%d minute=%d\n", tm.tm_year%100, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min); l = 5; p = msg_put(msg, l+2); @@ -872,11 +866,11 @@ static void enc_ie_date(unsigned char **ntmode, msg_t *msg, time_t ti, int nt, s qi->QI_ELEMENT(date) = p - (unsigned char *)qi - sizeof(Q931_info_t); p[0] = IE_DATE; p[1] = l; - p[2] = tm->tm_year % 100; - p[3] = tm->tm_mon + 1; - p[4] = tm->tm_mday; - p[5] = tm->tm_hour; - p[6] = tm->tm_min; + p[2] = tm.tm_year % 100; + p[3] = tm.tm_mon + 1; + p[4] = tm.tm_mday; + p[5] = tm.tm_hour; + p[6] = tm.tm_min; } |