Commit 100a53a5 authored by Libor Peltan's avatar Libor Peltan Committed by Daniel Salzman

serial policy: unixtime mimics bind behaviour - increment if lower

parent 85e2ac57
......@@ -1230,10 +1230,9 @@ Possible values:
\fBNOTE:\fP
.INDENT 0.0
.INDENT 3.5
If your serial was in other than unix time format, be careful
with the transition to unix time. It may happen that the new serial will
be \(aqlower\(aq than the old one. If this is the case, the transition should be
done by hand (\fI\%RFC 1982\fP).
In case of \fBunixtime\fP, if the resulting serial is lower or equal than current zone
(this happens e.g. in case of migrating from other policy or frequent updates)
the serial is incremented instead.
.sp
Use dateserial only if you expect less than 100 updates per day per zone.
.UNINDENT
......
......@@ -1386,10 +1386,9 @@ Possible values:
8 digits match the current iso-date
.. NOTE::
If your serial was in other than unix time format, be careful
with the transition to unix time. It may happen that the new serial will
be \'lower\' than the old one. If this is the case, the transition should be
done by hand (:rfc:`1982`).
In case of ``unixtime``, if the resulting serial is lower or equal than current zone
(this happens e.g. in case of migrating from other policy or frequent updates)
the serial is incremented instead.
Use dateserial only if you expect less than 100 updates per day per zone.
......
......@@ -59,11 +59,17 @@ static uint32_t serial_next_date(uint32_t current)
uint32_t serial_next(uint32_t current, int policy)
{
uint32_t candidate;
switch (policy) {
case SERIAL_POLICY_INCREMENT:
return current + 1;
case SERIAL_POLICY_UNIXTIME:
return time(NULL);
candidate = time(NULL);
if (serial_compare(candidate, current) != SERIAL_GREATER) {
return current + 1;
} else {
return candidate;
}
case SERIAL_POLICY_DATESERIAL:
return serial_next_date(current);
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment