Timehash question

Russ Allbery rra at stanford.edu
Mon Dec 29 04:24:45 UTC 2003

Zenon Panoussis <oracle at xs4all.nl> writes:

> I read C as a foreign language that I don't speak; sometimes I can guess
> what it means, more often I cant make head or tails of it.  However, I
> need to tell the timehash function to change directories every minute
> instead of every five minutes. Could some kind soul please tell me where
> to look and, more important, whether changing the time span in one place
> would break something in another?

The MakePath function, particularly:

    snprintf(path, length, "%s/time-%02x/%02x/%02x/%04x-%04x",
             innconf->patharticles, class,
             (now >> 16) & 0xff, (now >> 8) & 0xff, seqnum,
             (now & 0xff) | ((now >> 16 & 0xff00)));

and particularly the (now >> 8) & 0xff part, which changes directories
every 256 seconds, or a little over four minutes.  If you want to change
that, the easiest is probably to change it to:

    snprintf(path, length, "%s/time-%02x/%02x/%02x/%04x-%04x",
             innconf->patharticles, class,
             (now >> 15) & 0xff, (now >> 7) & 0xff, seqnum,
             (now & 0xff) | ((now >> 16 & 0xff00)));

which will change directories every 64 seconds.

Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>

    Please send questions to the list rather than mailing me directly.
     <http://www.eyrie.org/~eagle/faqs/questions.html> explains why.

More information about the inn-workers mailing list