[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: slap_timestamp with microsecond granularity?



> From: Michael Ströder
> Sent: Monday, April 28, 2014 11:47 PM
>
> slapo-accesslog records fractions of a second in attributes reqStart and
> reqEnd which both are declared use Generalized Time syntax.

Cool, thanks for the pointer. It looks like that code uses the second of the
options I considered, generating a one second granularity timestamp with the
existing function and then mashing the microseconds on top of it. Given that
method is evidently acceptable for this module, presumably it would also be
acceptable in the password policy module.

        char rdnbuf[STRLENOF(RDNEQ)+LDAP_LUTIL_GENTIME_BUFSIZE+8];
         [...]
        slap_timestamp( &op->o_time, &timestamp );
        snprintf( timestamp.bv_val + timestamp.bv_len-1, sizeof(".123456Z"),
".%06dZ", op->o_tincr );
        timestamp.bv_len += STRLENOF(".123456");

Even more conveniently, it looks like it's getting the microseconds value
from a member of the op structure, the ppolicy_bind_response function in
servers/slapd/overlays/ppolicy.c also has an op structure passed in, which
presumably should have the same microseconds value, so it looks like it
would be very trivial to emulate the above timestamp generating code in the
password policy module.

Thanks?