[collectd] BIND plugin - timezone issue

Bruno Prémont bonbons at linux-vserver.org
Wed Feb 22 22:44:01 CET 2012


Hi Robert, Florian,

On Mon, 20 February 2012 Florian Forster <octo at collectd.org> wrote:
> On Tue, Feb 14, 2012 at 01:49:20PM +1030, Robert Mibus wrote:
> > Is there any particular reason not to just use the current system's
> > time? ie. with the attached patch.
> 
> it seemed like a good idea at the time, but clearly we're having more
> trouble with it that it's worth.

The big trouble is that the functions for manipulating UTC time are not
available everywhere...

Initially the time parsing did use timegm() to convert utc time to time_t
but some Unix variant doesn't provide timegm() :( and thus timegm() was
replaced with mktime() which is timezone dependent.

> I'm not quite sure whether to just switch to using the local time or let
> the user chose with a configuration option. What do people think?

That's an option, but using the timestamp provided by bind is more
correct than the time used by collectd (didn't check if collectd's time
is the time at which curl request is submitted or the time at which
curl has returned the data)

In my opinion, only those limited Unix's should use mktime() or just use
collectd's system time but all others use timegm()... choosing the right
path via configure check.
(I think I did send such a patch some time ago)

Best reagrds,
Bruno

> Best regards,
> —octo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20120222/5f689af2/attachment.pgp>


More information about the collectd mailing list