[rrd-users] Date/time-related problem on Windows

Jurjen Oskam jurjen at stupendous.org
Thu Jan 22 21:09:11 CET 2009

On Wed, Jan 21, 2009 at 08:34:58PM +0100, Jurjen Oskam wrote:

> It's not necessary to update the rrd after creating it, to recreate the
> problem. These are the exact commands I used:
> rrdtool create example.rrd -s 1213398000  -s 900 DS:iops:DERIVE:1800:0:U RRA:AVERAGE:0.5:1:35136
> rrdtool graph -w 800 -h 200 -s 1213398000 -e 1230678000  try.png DEF:iops=example.rrd:iops:AVERAGE LINE:iops#00FF00:iops
> rrdtool graph -w 800 -h 200 -s 1213398001 -e 1230678000  try.png DEF:iops=example.rrd:iops:AVERAGE LINE:iops#00FF00:iops
> rrdtool graph -w 800 -h 200 -s 1213398000 -e 1230678001  try.png DEF:iops=example.rrd:iops:AVERAGE LINE:iops#00FF00:iops

In the meantime, I've found (as far as I can tell) the cause. When running
the commands above on a Linux machine, everything worked. Inspecting the
differences between the resulting graphs, the ones that fail on Windows
have "Week <XX>" on the X-axis. Grepping the sources for "Week" results in
two files, one of which is rrd_graph.c. Changing the two instances of "Week
%V" to "Week 42" resulted in a working Windows binary, with the obvious
downside that every week is now displayed as "Week 42". :)

Also, in the Windows VM I used to build rrdtool in, I do receive an error
when rrdtool fails to create a graph. Windows informs me that rrdtool has
crashed, with the error code 0xc0000417. This error code stands for
STATUS_INVALID_CRUNTIME_PARAMETER, with the explanation that "#An invalid
parameter was passed to a C runtime function."

Reading WIN32-BUILD-TIPS.txt, I found this:

> 4/10/05 Tobi
> The windows implementation of strftime does not seem to support
> the ISO 8601 week number (%V) I have therfore included the file
> strftime.[ch] which provides strftime_ ... if you compile rrdtool
> with -Dstrftime=_strftime and link strftime.o then you will
> get propper support for %V.

So, to me it looks like instead of the included strftime, the Windows
version of strftime is used, which doesn't know about %V.

Unfortunately, I couldn't figure out how to convince Visual Studio to use
the rrdtool-version of strftime. I guess something needs to be changed in
the file win32\config.h, but I haven't been able to find out what. While
there, I did update the version from 1.3.4 to 1.3.6; it looks like that
file was forgotten with 1.3.5 and 1.3.6. :)

What needs to be changed in the Windows build procedure to get it to use
the correct strftime?

Jurjen Oskam

Savage's Law of Expediency:
        You want it bad, you'll get it bad.

More information about the rrd-users mailing list