# [rrd-users] Re: How to save and graph NON-averages

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Tue Sep 26 01:03:06 MEST 2000

```BAARDA, Don wrote:

> 	AFAIK, the "time" used in rrd is just an integer (standard Unix time
> type) that is not used in any special way. This (should) mean that you can
> use any scaled "time" type as long as you are consistent. For example, in
> your case you could use a count of the number of days since your preferred
> start date, and increment the "time" by one each day. This would allow you
> to enter a single sample per day with no "normalising" and accumulate on day

It is, indeed, just an integer.

By design, you can't start an archive on an arbitrary point in time, it
will start on n*interval where n and interval are both integers.  Each
interval will therefore start on p*interval and end at q*interval with
both p and q being integers.  This has to do with the internals of the
program.

What happens if you divide an integer by another integer?  You get a
result and a remainder.  If you (well, not just you) decide to store
data in an RRA which has a resolution of 86400 seconds, RRDtool will
divide every time stamp it receives by 86400.  If the remainder is not
zero, that means that a portion of the value is valid for the previous
interval and a portion of the value is valid for the current interval.

It was exactly this what the original poster didn't want to happen.

Therefore, he has to make sure the remainder is zero.  That can only be
the case if the time stamp is an exact multiply of 86400 (or any other
interval choosen).

> 	WARNING: I vaguely recall that someone posted that rrd has problems
> with dates before some time after 1970. I don't know why this would be the
> case, but if true, you would probably have to add some starting offset to
> your "timescale" when using this technique.

The time and date used in RRDtool is related closely, no: very closely,
to the unix epoch.  It is January 1st, 1970, 00:00  ---->UTC<----
Snippet from the man page of time(2):
time returns the time since 00:00:00 GMT, January 1, 1970,
measured in seconds.
(I'm used to say UTC, as GMT means BST for some people when it's summer).

Tobi decided, probably for good reasons, not to accept negative times.
I can only guess at this but my guess is that it has to do with overflow
detection or with problems on certain platforms.

If negative times are not allowed, the first possible time in an RRD is
exactly januari 1st, 1970, 00:00 UTC.

If a database should contain intervals of 86400 seconds, the first will
start on 19700101 00:00 UTC and will end on 19700102 00:00 UTC.

There's no way to create a database with 86400 second intervals that has
an interval from 19700101 16:00 UTC to 19700102 16:00 UTC.

Now add any number of days to both examples and you'll see that the same
applies for *any* interval: it must start and end at 00:00 UTC.

You can have intervals of 3600 seconds.  This makes it possible to have
interval boundaries at both 19700101 16:00 UTC and 19700102 16:00 UTC.
However, this also gives you 23 (and not 24!) extra intervals per day.
It will increase the size of your database (considerably) so if you don't
need to, don't do it.  It is however perfectly legal to do so and for
people who want to see *their* midnight and not midnight on UTC time, it
is the only way.  If this would be done otherwise, daylight saving will
<insert four or five letter word here> up the averages.

regards,
--
__________________________________________________________________
/ alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. |
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-users