Another timing related bug fix.

View: New views
1 Messages — Rating Filter:   Alert me  

Another timing related bug fix.

by Suresh Sundriyal-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

While testing indication persistence, I came across a weird bug. Every time I restarted
 Openwsman the expiretime on the saved subscriptions would increase by an hour.
This took a while to figure out.

In ws_set_expiretime, we use mktime to convert tmx.tm structure to convert to epoch
time. mktime() corrects for dst based on the value of tmx.tm.tm_isdst. However, in
ws_serialize_datetime() method, where we actually populate tmx.tm structure, we do
not populate the value of tmx.tm.tm_isdst. This causes a time skew on systems that
have the value set.

The patch fixes the code so that the tmx.tm.tm_isdst structure is populated while
serializing xmldatetime.

--
Regards,
Suresh
[expiretime.diff]

Index: src/lib/wsman-xml-serialize.c
===================================================================
--- src/lib/wsman-xml-serialize.c (revision 3254)
+++ src/lib/wsman-xml-serialize.c (working copy)
@@ -1862,6 +1862,11 @@
  }
  tmx->tm.tm_year -= 1900;
  tmx->tm.tm_mon -= 1;
+        struct tm tm;
+        time_t t;
+        t = time(NULL);
+        localtime_r(&t, &tm);
+        tmx->tm.tm_isdst = tm.tm_isdst;
  if (hours < 0) {
  tmx->tz_min = 60 * hours - mins;
  } else {


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Openwsman-devel mailing list
Openwsman-devel@...
https://lists.sourceforge.net/lists/listinfo/openwsman-devel