Module: sip-router
Branch: janakj/postgres
Commit: d79af6c63a8386f8d50b5dc41e045e754a70a587
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d79af6c…
Author: Jan Janak <jan(a)iptel.org>
Committer: Jan Janak <jan(a)iptel.org>
Date: Mon Apr 14 18:52:47 2003 +0000
- fixed daylight saving bug previously found in mysql module
- struct tm structure properly initialized
- gmtime changed to localtime because mktime expects local time later
---
modules/db_postgres/db_val.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/modules/db_postgres/db_val.c b/modules/db_postgres/db_val.c
index 6c91a7d..9af7d9e 100644
--- a/modules/db_postgres/db_val.c
+++ b/modules/db_postgres/db_val.c
@@ -33,6 +33,9 @@
* History
* -------
* 2003-04-06 initial code written (Greg Fausak/Andy Fullford)
+ * 2003-04-14 gmtime changed to localtime because mktime later
+ * expects localtime, changed daylight saving bug
+ * previously found in mysql module (janakj)
*
*/
@@ -94,7 +97,15 @@ static inline int str2time(const char* _s, time_t* _v)
}
#endif
+ memset(&t, '\0', sizeof(struct tm));
strptime(_s,"%Y-%m-%d %H:%M:%S %z",&t);
+
+ /* Daylight saving information got lost in the database
+ * so let mktime to guess it. This eliminates the bug when
+ * contacts reloaded from the database have different time
+ * of expiration by one hour when daylight saving is used
+ */
+ t.tm_isdst = -1;
*_v = mktime(&t);
return 0;
@@ -147,7 +158,7 @@ static inline int time2str(time_t _v, char* _s, int* _l)
}
#endif
- t = gmtime(&_v);
+ t = localtime(&_v);
if((bl=strftime(_s,(size_t)(*_l)-1,"'%Y-%m-%d %H:%M:%S %z'",t))>0)
*_l = bl;
Module: sip-router
Branch: janakj/postgres
Commit: 80b11a1361effef6faf817f2e5a9d2b4649793ad
URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=80b11a1…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Fri May 23 15:43:42 2003 +0000
- updated all makefiles (now 'cd modules/foo; make' will link with the
proper libraries). Please add an "include ../../Makefile.defs" as first
line of the local module Makefile if your module is not on the cvs)
---
modules/db_postgres/Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/modules/db_postgres/Makefile b/modules/db_postgres/Makefile
index 50a2133..5dae7f9 100644
--- a/modules/db_postgres/Makefile
+++ b/modules/db_postgres/Makefile
@@ -2,6 +2,7 @@
#
# WARNING: do not run this directly, it should be run by the master Makefile
+include ../../Makefile.defs
auto_gen=
NAME=postgres.so