[asterisk-commits] trunk r10805 - in /trunk: ./ apps/ channels/
codecs/gsm/ funcs/ include/aster...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Feb 22 15:53:50 MST 2006
Author: kpfleming
Date: Wed Feb 22 16:53:49 2006
New Revision: 10805
URL: http://svn.digium.com/view/asterisk?rev=10805&view=rev
Log:
merge rizzo's patch to make compiler warnings stop the build, and fix a bunch of warnings found
Modified:
trunk/Makefile
trunk/apps/app_sms.c
trunk/channels/Makefile
trunk/channels/chan_sip.c
trunk/codecs/gsm/Makefile
trunk/funcs/func_enum.c
trunk/include/asterisk/sha1.h
trunk/res/res_features.c
trunk/res/res_osp.c
trunk/say.c
Modified: trunk/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/Makefile?rev=10805&r1=10804&r2=10805&view=diff
==============================================================================
--- trunk/Makefile (original)
+++ trunk/Makefile Wed Feb 22 16:53:49 2006
@@ -233,6 +233,10 @@
INCLUDE+=-Iinclude -I../include
ASTCFLAGS+=-pipe -Wall -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations $(DEBUG) $(INCLUDE) -D_REENTRANT -D_GNU_SOURCE #-DMAKE_VALGRIND_HAPPY
ASTCFLAGS+=$(OPTIMIZE)
+ASTCFLAGS+= -Werror -Wunused
+ifeq ($(shell gcc -v 2>&1 | grep 'gcc version' | cut -f3 -d' ' | cut -f1 -d.),4)
+ASTCFLAGS+= -Wno-pointer-sign
+endif
ASTOBJ=-o asterisk
ifeq ($(findstring BSD,$(OSARCH)),BSD)
Modified: trunk/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_sms.c?rev=10805&r1=10804&r2=10805&view=diff
==============================================================================
--- trunk/apps/app_sms.c (original)
+++ trunk/apps/app_sms.c Wed Feb 22 16:53:49 2006
@@ -693,7 +693,7 @@
}
while (fgets (line, sizeof (line), s))
{ /* process line in file */
- char *p;
+ unsigned char *p;
for (p = line; *p && *p != '\n' && *p != '\r'; p++);
*p = 0; /* strip eoln */
p = line;
@@ -713,7 +713,7 @@
{ /* parse message (UTF-8) */
unsigned char o = 0;
while (*p && o < SMSLEN)
- h->ud[o++] = utf8decode((unsigned char **)&p);
+ h->ud[o++] = utf8decode(&p);
h->udl = o;
if (*p)
ast_log (LOG_WARNING, "UD too long in %s\n", fn);
Modified: trunk/channels/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/channels/Makefile?rev=10805&r1=10804&r2=10805&view=diff
==============================================================================
--- trunk/channels/Makefile (original)
+++ trunk/channels/Makefile Wed Feb 22 16:53:49 2006
@@ -222,7 +222,7 @@
$(CC) $(SOLINK) -o $@ $< -lnbs
chan_vpb.o: chan_vpb.c
- $(CXX) -c $(CFLAGS) -o $@ chan_vpb.c
+ $(CXX) -c $(CFLAGS:-Werror=) -o $@ chan_vpb.c
chan_vpb.so: chan_vpb.o
$(CXX) $(SOLINK) -o $@ $< -lvpb -lpthread -lm -ldl
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=10805&r1=10804&r2=10805&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Feb 22 16:53:49 2006
@@ -12097,7 +12097,7 @@
int obproxyfound=0;
int found=0;
int format=0; /* Ama flags */
- time_t regseconds;
+ time_t regseconds = 0;
char *varname = NULL, *varval = NULL;
struct ast_variable *tmpvar = NULL;
struct ast_flags peerflags = {(0)};
Modified: trunk/codecs/gsm/Makefile
URL: http://svn.digium.com/view/asterisk/trunk/codecs/gsm/Makefile?rev=10805&r1=10804&r2=10805&view=diff
==============================================================================
--- trunk/codecs/gsm/Makefile (original)
+++ trunk/codecs/gsm/Makefile Wed Feb 22 16:53:49 2006
@@ -364,7 +364,7 @@
# Default rules
.c.o:
- $(CC) $(CFLAGS) $?
+ $(CC) $(CFLAGS:-Werror=) $?
@-mv `$(BASENAME) $@` $@ > /dev/null 2>&1
# Target rules
Modified: trunk/funcs/func_enum.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_enum.c?rev=10805&r1=10804&r2=10805&view=diff
==============================================================================
--- trunk/funcs/func_enum.c (original)
+++ trunk/funcs/func_enum.c Wed Feb 22 16:53:49 2006
@@ -88,7 +88,7 @@
args.options = "1";
/* strip any '-' signs from number */
- for (p = args.number, s = p; *s; *s++) {
+ for (s = p = args.number; *s; s++) {
if (*s != '-')
*p++ = *s;
}
Modified: trunk/include/asterisk/sha1.h
URL: http://svn.digium.com/view/asterisk/trunk/include/asterisk/sha1.h?rev=10805&r1=10804&r2=10805&view=diff
==============================================================================
--- trunk/include/asterisk/sha1.h (original)
+++ trunk/include/asterisk/sha1.h Wed Feb 22 16:53:49 2006
@@ -32,7 +32,6 @@
* name meaning
* uint32_t unsigned 32 bit integer
* uint8_t unsigned 8 bit integer (i.e., unsigned char)
- * int_least16_t integer of >= 16 bits
*
*/
@@ -60,7 +59,7 @@
uint32_t Length_High; /* Message length in bits */
/* Index into message block array */
- int_least16_t Message_Block_Index;
+ uint32_t Message_Block_Index; /* 8 bits actually suffice */
uint8_t Message_Block[64]; /* 512-bit message blocks */
int Computed; /* Is the digest computed? */
Modified: trunk/res/res_features.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_features.c?rev=10805&r1=10804&r2=10805&view=diff
==============================================================================
--- trunk/res/res_features.c (original)
+++ trunk/res/res_features.c Wed Feb 22 16:53:49 2006
@@ -483,7 +483,7 @@
len = strlen(touch_monitor) + 50;
args = alloca(len);
touch_filename = alloca(len);
- snprintf(touch_filename, len, "auto-%ld-%s", time(NULL), touch_monitor);
+ snprintf(touch_filename, len, "auto-%ld-%s", (long)time(NULL), touch_monitor);
snprintf(args, len, "%s|%s|m", (touch_format) ? touch_format : "wav", touch_filename);
} else {
caller_chan_id = ast_strdupa(caller_chan->cid.cid_num ? caller_chan->cid.cid_num : caller_chan->name);
@@ -491,7 +491,7 @@
len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50;
args = alloca(len);
touch_filename = alloca(len);
- snprintf(touch_filename, len, "auto-%ld-%s-%s", time(NULL), caller_chan_id, callee_chan_id);
+ snprintf(touch_filename, len, "auto-%ld-%s-%s", (long)time(NULL), caller_chan_id, callee_chan_id);
snprintf(args, len, "%s|%s|m", (touch_format) ? touch_format : "wav", touch_filename);
}
Modified: trunk/res/res_osp.c
URL: http://svn.digium.com/view/asterisk/trunk/res/res_osp.c?rev=10805&r1=10804&r2=10805&view=diff
==============================================================================
--- trunk/res/res_osp.c (original)
+++ trunk/res/res_osp.c Wed Feb 22 16:53:49 2006
@@ -568,7 +568,7 @@
char destination[2048]="";
char token[2000];
char tmp[256]="", *l, *n;
- char *devinfo = NULL;
+ const char *devinfo = NULL;
result->handle = -1;
result->numresults = 0;
Modified: trunk/say.c
URL: http://svn.digium.com/view/asterisk/trunk/say.c?rev=10805&r1=10804&r2=10805&view=diff
==============================================================================
--- trunk/say.c (original)
+++ trunk/say.c Wed Feb 22 16:53:49 2006
@@ -3114,13 +3114,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -3150,13 +3151,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -3336,13 +3338,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -3362,13 +3365,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -3534,13 +3538,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -3560,10 +3565,11 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
@@ -3742,14 +3748,15 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
char todo = format[offset]; /* The letter to format*/
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
if (todo == 'Q') {
@@ -3902,13 +3909,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -3928,13 +3936,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -4126,13 +4135,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -4152,13 +4162,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -4332,15 +4343,16 @@
* language to say the date, with changes in what you say, depending
* upon how recent the date is. XXX */
{
- struct timeval now;
+ struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
- gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ gettimeofday(&now,NULL);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -4357,13 +4369,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -4562,13 +4575,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -4585,13 +4599,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -4777,13 +4792,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -4803,13 +4819,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -5053,13 +5070,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -5079,13 +5097,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
@@ -6092,13 +6111,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
res = wait_file(chan,ints, "digits/today",lang);
@@ -6118,13 +6138,14 @@
{
struct timeval now;
struct tm tmnow;
- time_t beg_today;
+ time_t beg_today, tt;
gettimeofday(&now,NULL);
- ast_localtime(&now.tv_sec,&tmnow,timezone);
+ tt = now.tv_sec;
+ ast_localtime(&tt,&tmnow,timezone);
/* This might be slightly off, if we transcend a leap second, but never more off than 1 second */
/* In any case, it saves not having to do ast_mktime() */
- beg_today = now.tv_sec - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
+ beg_today = tt - (tmnow.tm_hour * 3600) - (tmnow.tm_min * 60) - (tmnow.tm_sec);
if (beg_today < time) {
/* Today */
} else if ((beg_today - 86400) < time) {
More information about the asterisk-commits
mailing list