Paul B. Henson wrote:
On Fri, May 23, 2014 at 08:51:02PM -0700, Howard Chu wrote:
You need to actually use microseconds, since the time-increment is
only unique on the local server and will not guarantee uniqueness in a
replication scenario.
Attached is an updated patch for this ITS which uses microseconds rather
than the time-increment, maintains the semantics of "now" being when the
code is called rather than when the operation began, and copies the
first timestamp to create a second with microseconds rather than
redundantly calling slapd_timestamp.
Let me know if there's anything else that needs to be fixed or changed.
You've got the right idea now but not making best use of the APIs.
ldap_pvt_gettime() returns structured time. There is no reason to then call
lutil_tm2time() to turn it into seconds, and then call slap_timestamp() which
must turn seconds into structured time again for formatting. Personally I
would just sprintf a timestamp here using the lutil_tm structure.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/