Title: HTML Signature
Hi!

Running pmacct 0.14.2 for traffic accounting here in NZ.  We are a small ISP in the antipodes, and run all servers on NZ local time, as the country only has one time zone effectively.

Found a bug in pmacct 0.14.2 with runing through a DST roll over.  Looks like an oversight.  The tm_isdst flag is set to zero in the calls to mktime() in src/util.c.  It should be initialized to -1 per mktime(3) man page.  This should work for Linux, OpenBSD, FreeBSD, NetBSD  and MacOSX/Darwin.

If you want to add a config handler flag for this, it might be a good idea.

Please find the patch attached below.

Best Regards,

Matthew Grant
--

Regards,
Matthew Grant | Systems Engineer

Phone: 0800 5000 24 | +64 3 962 9510

Voice & Data

www.voyager.co.nz
+64 9 444 4444

Hosting & Cloud

www.net24.co.nz
0800 5000 24

Domains & Email

www.1stdomains.co.nz
+64 3 962 9520

This patch sets the struct_time tm_isdst flag to -1, to tell libc to determine
DST from system time zone database.  This should prevent pmacct getting
stamp_inserted wrong over DST roll over.

This patch should work for Linux, FreeBSD, NetBSD, OpenBSD and MacOSX/Darwin.

Matthew Grant <[email protected]> Mon, 06 May 2013 14:46:38 +1200
Index: pmacct-0.14.2/src/util.c
===================================================================
--- pmacct-0.14.2.orig/src/util.c	2013-05-06 14:50:36.811097741 +1200
+++ pmacct-0.14.2/src/util.c	2013-05-06 14:53:46.281424257 +1200
@@ -330,6 +330,8 @@
     }
   }
 
+  /* Tell libc to sort DST rollover when calculating over start/end of DST */
+  rounded->tm_isdst = -1;
   t = mktime(rounded);
   return t;
 }
@@ -349,6 +351,8 @@
     howmany--;
   }
 
+  /* Tell libc to sort DST rollover when calculating over start/end of DST */
+  tmt->tm_isdst = -1;
   final = mktime(tmt);
   
   return (final-base);
_______________________________________________
pmacct-discussion mailing list
http://www.pmacct.net/#mailinglists

Reply via email to