]> git.sur5r.net Git - openldap/commitdiff
add create/modify timestamp to all entries; use monitorTimestamp for start/current...
authorPierangelo Masarati <ando@openldap.org>
Thu, 15 May 2003 01:19:30 +0000 (01:19 +0000)
committerPierangelo Masarati <ando@openldap.org>
Thu, 15 May 2003 01:19:30 +0000 (01:19 +0000)
servers/slapd/back-monitor/back-monitor.h
servers/slapd/back-monitor/backend.c
servers/slapd/back-monitor/conn.c
servers/slapd/back-monitor/database.c
servers/slapd/back-monitor/init.c
servers/slapd/back-monitor/listener.c
servers/slapd/back-monitor/log.c
servers/slapd/back-monitor/operation.c
servers/slapd/back-monitor/rww.c
servers/slapd/back-monitor/sent.c
servers/slapd/back-monitor/time.c

index 8366b6cd23fa2be97f44f9510d0b408dc87fb1a8..0ab1bbabd5ab5f9f76bd748bd393e056a1f56aae 100644 (file)
@@ -81,7 +81,8 @@ struct monitorinfo {
        /*
         * Config parameters
         */
-       struct berval           l;
+       struct berval           mi_l;
+       struct berval           mi_startTime;   /* don't free it */
 
        /*
         * Specific schema entities
@@ -104,6 +105,7 @@ struct monitorinfo {
        AttributeDescription *ad_monitorConnectionAuthzDN;
        AttributeDescription *ad_monitorConnectionLocalAddress;
        AttributeDescription *ad_monitorConnectionPeerAddress;
+       AttributeDescription *ad_monitorTimestamp;
 
        /*
         * Generic description attribute
index 7e337758ace26dd619f884418ccbb6ad35e9533a..67eef9c256694fe688347e030fc9006c127697cf 100644 (file)
@@ -86,12 +86,16 @@ monitor_subsys_backend_init(
                                "dn: cn=Backend %d,%s\n"
                                "objectClass: %s\n"
                                "structuralObjectClass: %s\n"
-                               "cn: Backend %d\n",
+                               "cn: Backend %d\n"
+                               "createTimestamp: %s\n"
+                               "modifyTimestamp: %s\n",
                                i,
                                monitor_subsys[SLAPD_MONITOR_BACKEND].mss_dn.bv_val,
                                mi->oc_monitoredObject->soc_cname.bv_val,
                                mi->oc_monitoredObject->soc_cname.bv_val,
-                               i );
+                               i,
+                               mi->mi_startTime.bv_val,
+                               mi->mi_startTime.bv_val );
                
                e = str2entry( buf );
                if ( e == NULL ) {
index 2e4f518ff1284c27ebe7fd9ebb36e43e201a06c1..d2fe8d447107252c2cb5f11d63cdfdb7b5b21f87 100644 (file)
@@ -84,10 +84,14 @@ monitor_subsys_conn_init(
                "dn: cn=Total,%s\n"
                "objectClass: %s\n"
                "structuralObjectClass: %s\n"
-               "cn: Total\n",
+               "cn: Total\n"
+               "createTimestamp: %s\n"
+               "modifyTimestamp: %s\n",
                monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val,
                mi->oc_monitorCounterObject->soc_cname.bv_val,
-               mi->oc_monitorCounterObject->soc_cname.bv_val );
+               mi->oc_monitorCounterObject->soc_cname.bv_val,
+               mi->mi_startTime.bv_val,
+               mi->mi_startTime.bv_val );
        
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -144,10 +148,14 @@ monitor_subsys_conn_init(
                "dn: cn=Current,%s\n"
                "objectClass: %s\n"
                "structuralObjectClass: %s\n"
-               "cn: Current\n",
+               "cn: Current\n"
+               "createTimestamp: %s\n"
+               "modifyTimestamp: %s\n",
                monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val,
                mi->oc_monitorCounterObject->soc_cname.bv_val,
-               mi->oc_monitorCounterObject->soc_cname.bv_val );
+               mi->oc_monitorCounterObject->soc_cname.bv_val,
+               mi->mi_startTime.bv_val,
+               mi->mi_startTime.bv_val );
        
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -268,18 +276,41 @@ conn_create(
 
        Entry                   *e;
 
+       struct tm       *ctm;
+       char            ctmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+       struct tm       *mtm;
+       char            mtmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+
        assert( c != NULL );
        assert( ep != NULL );
 
+       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
+#ifdef HACK_LOCAL_TIME
+       ctm = localtime( &c->c_starttime );
+       lutil_localtime( ctmbuf, sizeof( ctmbuf ), ctm, -timezone );
+       mtm = localtime( &c->c_activitytime );
+       lutil_localtime( mtmbuf, sizeof( mtmbuf ), mtm, -timezone );
+#else /* !HACK_LOCAL_TIME */
+       ctm = gmtime( &c->c_starttime );
+       lutil_gentime( ctmbuf, sizeof( ctmbuf ), ctm );
+       mtm = gmtime( &c->c_activitytime );
+       lutil_gentime( mtmbuf, sizeof( mtmbuf ), mtm );
+#endif /* !HACK_LOCAL_TIME */
+       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
+
        snprintf( buf, sizeof( buf ),
                "dn: cn=" CONN_CN_PREFIX " %ld,%s\n"
                "objectClass: %s\n"
                "structuralObjectClass: %s\n"
-               "cn: " CONN_CN_PREFIX " %ld\n",
+               "cn: " CONN_CN_PREFIX " %ld\n"
+               "createTimestamp: %s\n"
+               "modifyTimestamp: %s\n",
                c->c_connid, monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val,
                mi->oc_monitorConnection->soc_cname.bv_val,
                mi->oc_monitorConnection->soc_cname.bv_val,
-               c->c_connid );
+               c->c_connid,
+               ctmbuf, mtmbuf );
+               
        e = str2entry( buf );
 
        if ( e == NULL) {
index 68fb8dc64582d8709ece301a58cd6d71d28d18e0..6ee2db645795f04007276c8e36812d22cf277e10 100644 (file)
@@ -53,7 +53,6 @@ monitor_subsys_database_init(
        Entry                   *e, *e_database, *e_tmp;
        int                     i;
        struct monitorentrypriv *mp;
-       const char              *text = NULL;
 
        assert( be != NULL );
 
@@ -95,14 +94,18 @@ monitor_subsys_database_init(
                                "structuralObjectClass: %s\n"
                                "cn: Database %d\n"
                                "description: This object contains the type of the database.\n"
-                               "%s: %s",
+                               "%s: %s\n"
+                               "createTimestamp: %s\n"
+                               "modifyTimestamp: %s\n",
                                i,
                                monitor_subsys[SLAPD_MONITOR_DATABASE].mss_dn.bv_val,
                                mi->oc_monitoredObject->soc_cname.bv_val,
                                mi->oc_monitoredObject->soc_cname.bv_val,
                                i,
                                mi->ad_monitoredInfo->ad_cname.bv_val,
-                               be->bd_info->bi_type );
+                               be->bd_info->bi_type,
+                               mi->mi_startTime.bv_val,
+                               mi->mi_startTime.bv_val );
                
                e = str2entry( buf );
                if ( e == NULL ) {
index 116e411599b3033abb0f06c24abdf285d72fdb0d..e6c41ba8211094895eea4c2f0d12a8b89e2609b7 100644 (file)
@@ -36,6 +36,7 @@
 #include <stdio.h>
 #include <ac/string.h>
 
+#include <lutil.h>
 #include "slap.h"
 #include "lber_pvt.h"
 #include "back-monitor.h"
@@ -433,14 +434,41 @@ monitor_back_db_open(
                        "NO-USER-MODIFICATION "
                        "USAGE directoryOperation )",
                        offsetof(struct monitorinfo, ad_monitorConnectionPeerAddress) },
+               { "monitorTimestamp", "( 1.3.6.1.4.1.4203.666.1.24 "
+                       "NAME 'monitorTimestamp' "
+                       "DESC 'monitor timestamp' "
+                       "EQUALITY generalizedTimeMatch "
+                       "ORDERING generalizedTimeOrderingMatch "
+                       "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 "
+                       "SINGLE-VALUE )",
+                       offsetof(struct monitorinfo, ad_monitorTimestamp) },
                { NULL, NULL, -1 }
        };
 
+       struct tm               *tms;
+       static char             tmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+
+       /*
+        * Start
+        */
+       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
+#ifdef HACK_LOCAL_TIME
+       tms = localtime( &starttime );
+       lutil_localtime( tmbuf, sizeof(tmbuf), tms, -timezone );
+#else /* !HACK_LOCAL_TIME */
+       tms = gmtime( &starttime );
+       lutil_gentime( tmbuf, sizeof(tmbuf), tms );
+#endif /* !HACK_LOCAL_TIME */
+       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
+
+       mi->mi_startTime.bv_val = tmbuf;
+       mi->mi_startTime.bv_len = strlen( tmbuf );
+
        for ( i = 0; mat[i].name; i++ ) {
-               LDAPAttributeType *at;
-               int             code;
-               const char      *err;
-               AttributeDescription **ad;
+               LDAPAttributeType       *at;
+               int                     code;
+               const char              *err;
+               AttributeDescription    **ad;
 
                at = ldap_str2attributetype( mat[i].schema, &code,
                                &err, LDAP_SCHEMA_ALLOW_ALL );
@@ -642,11 +670,15 @@ monitor_back_db_open(
                                "dn: %s\n"
                                "objectClass: %s\n"
                                "structuralObjectClass: %s\n"
-                               "cn: %s\n",
+                               "cn: %s\n"
+                               "createTimestamp: %s\n"
+                               "modifyTimestamp: %s\n",
                                monitor_subsys[ i ].mss_dn.bv_val,
                                mi->oc_monitorContainer->soc_cname.bv_val,
                                mi->oc_monitorContainer->soc_cname.bv_val,
-                               monitor_subsys[ i ].mss_name );
+                               monitor_subsys[ i ].mss_name,
+                               mi->mi_startTime.bv_val,
+                               mi->mi_startTime.bv_val );
                
                e = str2entry( buf );
                
@@ -696,14 +728,18 @@ monitor_back_db_open(
                "cn: Monitor\n"
                "%s: This subtree contains monitoring/managing objects.\n"
                "%s: This object contains information about this server.\n"
-               "%s: createTimeStamp reflects the time this server instance was created.\n"
-               "%s: modifyTimeStamp reflects the current time.\n",
+               "%s: createTimestamp reflects the time this server instance was created.\n"
+               "%s: modifyTimestamp reflects the current time.\n"
+               "createTimestamp: %s\n"
+               "modifyTimestamp: %s\n",
                mi->oc_monitorServer->soc_cname.bv_val,
                mi->oc_monitorServer->soc_cname.bv_val,
                mi->ad_description->ad_cname.bv_val,
                mi->ad_description->ad_cname.bv_val,
                mi->ad_description->ad_cname.bv_val,
-               mi->ad_description->ad_cname.bv_val );
+               mi->ad_description->ad_cname.bv_val,
+               mi->mi_startTime.bv_val,
+               mi->mi_startTime.bv_val );
 
        e = str2entry( buf );
        if ( e == NULL) {
@@ -741,7 +777,7 @@ monitor_back_db_open(
                return( -1 );
        }
 
-       if ( mi->l.bv_len ) {
+       if ( mi->mi_l.bv_len ) {
                AttributeDescription    *ad = NULL;
                const char              *text = NULL;
 
@@ -756,7 +792,7 @@ monitor_back_db_open(
                        return( -1 );
                }
                
-               if ( attr_merge_normalize_one( e, ad, &mi->l, NULL ) ) {
+               if ( attr_merge_normalize_one( e, ad, &mi->mi_l, NULL ) ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG( OPERATION, CRIT,
                                "unable to add locality to '%s' entry\n",
@@ -840,7 +876,7 @@ monitor_back_db_config(
                        return 1;
                }
                
-               ber_str2bv( argv[ 1 ], 0, 1, &mi->l );
+               ber_str2bv( argv[ 1 ], 0, 1, &mi->mi_l );
 
        } else {
 #ifdef NEW_LOGGING
index 3be41b5502ab001fe8b2c9a601afb6fce03c4ce0..bcb540c4160f07137cbc60aa6afab4b91c32359c 100644 (file)
@@ -95,7 +95,9 @@ monitor_subsys_listener_init(
                                "structuralObjectClass: %s\n"
                                "cn: Listener %d\n"
                                "%s: %s\n"
-                               "labeledURI: %s",
+                               "labeledURI: %s\n"
+                               "createTimestamp: %s\n"
+                               "modifyTimestamp: %s\n",
                                i,
                                monitor_subsys[SLAPD_MONITOR_LISTENER].mss_dn.bv_val,
                                mi->oc_monitoredObject->soc_cname.bv_val,
@@ -103,7 +105,9 @@ monitor_subsys_listener_init(
                                i,
                                mi->ad_monitorConnectionLocalAddress->ad_cname.bv_val,
                                l[i]->sl_name.bv_val,
-                               l[i]->sl_url.bv_val );
+                               l[i]->sl_url.bv_val,
+                               mi->mi_startTime.bv_val,
+                               mi->mi_startTime.bv_val );
                
                e = str2entry( buf );
                if ( e == NULL ) {
index d3bca6dee5913e9e5535edc740fb2bb59a862fc2..2cce628347dbd8c5fdbaa374bae670ea6b9ae9f4 100644 (file)
@@ -213,8 +213,8 @@ monitor_subsys_log_modify(
 
        /* set the new debug level */
        if ( rc == LDAP_SUCCESS ) {
-               const char *text;
-               static char textbuf[ BACKMONITOR_BUFSIZE ];
+               const char      *text;
+               static char     textbuf[ BACKMONITOR_BUFSIZE ];
 
                /* check for abandon */
                if ( op->o_abandon ) {
index 9f0ca01cf998816ac31f08b59f6fe075245f3811..1e4fb34ba7ebaf694f955e0e657bace0357d2ab0 100644 (file)
@@ -51,7 +51,8 @@ static struct berval
                BER_BVC( "Compare" ),
                BER_BVC( "Search" ),
                BER_BVC( "Abandon" ),
-               BER_BVC( "Extended" )
+               BER_BVC( "Extended" ),
+               { 0, NULL }
        };
 
 int
@@ -100,14 +101,18 @@ monitor_subsys_ops_init(
                                "structuralObjectClass: %s\n"
                                "cn: %s\n"
                                "%s: 0\n"
-                               "%s: 0\n",
+                               "%s: 0\n"
+                               "createTimestamp: %s\n"
+                               "modifyTimestamp: %s\n",
                                bv_op[ i ].bv_val,
                                monitor_subsys[SLAPD_MONITOR_OPS].mss_dn.bv_val,
                                mi->oc_monitorOperation->soc_cname.bv_val,
                                mi->oc_monitorOperation->soc_cname.bv_val,
                                bv_op[ i ].bv_val,
                                mi->ad_monitorOpInitiated->ad_cname.bv_val,
-                               mi->ad_monitorOpCompleted->ad_cname.bv_val );
+                               mi->ad_monitorOpCompleted->ad_cname.bv_val,
+                               mi->mi_startTime.bv_val,
+                               mi->mi_startTime.bv_val );
 
                e = str2entry( buf );
                if ( e == NULL ) {
@@ -173,7 +178,6 @@ monitor_subsys_ops_update(
        long            nInitiated = -1, nCompleted = -1;
        char            *rdnvalue;
        int             i;
-       ber_len_t       len;
        Attribute       *a;
        char            buf[] = "+9223372036854775807L";
 
@@ -183,9 +187,8 @@ monitor_subsys_ops_update(
        rdnvalue = e->e_dn + ( sizeof( "cn=" ) - 1 );
 
        for (i = 0; i < SLAP_OP_LAST; i++ ) {
-               len = bv_op[ i ].bv_len;
-
-               if ( strncmp( rdnvalue, bv_op[ i ].bv_val, len ) == 0 ) {
+               if ( strncmp( rdnvalue, bv_op[ i ].bv_val, 
+                                       bv_op[ i ].bv_len ) == 0 ) {
                        nInitiated = num_ops_initiated_[ i ];
                        nCompleted = num_ops_completed_[ i ];
                        break;
index 0f7cf75eb3b6681df08e9bb323674626cb87eac3..82992b960b6af04f46fdc468dcb57ca43ea95fd3 100644 (file)
@@ -82,10 +82,14 @@ monitor_subsys_rww_init(
                "dn: cn=Read,%s\n"
                "objectClass: %s\n"
                "structuralObjectClass: %s\n"
-               "cn: Read\n",
+               "cn: Read\n"
+               "createTimestamp: %s\n"
+               "modifyTimestamp: %s\n",
                monitor_subsys[SLAPD_MONITOR_RWW].mss_dn.bv_val,
                mi->oc_monitorCounterObject->soc_cname.bv_val,
-               mi->oc_monitorCounterObject->soc_cname.bv_val );
+               mi->oc_monitorCounterObject->soc_cname.bv_val,
+               mi->mi_startTime.bv_val,
+               mi->mi_startTime.bv_val );
        
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -139,10 +143,14 @@ monitor_subsys_rww_init(
                "dn: cn=Write,%s\n"
                "objectClass: %s\n"
                "structuralObjectClass: %s\n"
-               "cn: Write\n",
+               "cn: Write\n"
+               "createTimestamp: %s\n"
+               "modifyTimestamp: %s\n",
                monitor_subsys[SLAPD_MONITOR_RWW].mss_dn.bv_val,
                mi->oc_monitorCounterObject->soc_cname.bv_val,
-               mi->oc_monitorCounterObject->soc_cname.bv_val );
+               mi->oc_monitorCounterObject->soc_cname.bv_val,
+               mi->mi_startTime.bv_val,
+               mi->mi_startTime.bv_val );
        
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -214,10 +222,7 @@ monitor_subsys_rww_update(
        int                     type = RWW_NONE;
        
        Attribute               *a;
-       struct berval           *b = NULL;
        char                    buf[] = "+9223372036854775807L";
-       
-       char                    *str = NULL;
        long                    num = 0;
 
        assert( mi != NULL );
index 3637f4fd39e7d5e7ca922f5c412dbdbfdb5e7123..a658a698ecc382d8a48d6877a4fd9a6a92d3bab0 100644 (file)
@@ -81,10 +81,14 @@ monitor_subsys_sent_init(
                        "dn: cn=Entries,%s\n"
                        "objectClass: %s\n"
                        "structuralObjectClass: %s\n"
-                       "cn: Entries\n",
+                       "cn: Entries\n"
+                       "createTimestamp: %s\n"
+                       "modifyTimestamp: %s\n",
                        monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
                        mi->oc_monitorCounterObject->soc_cname.bv_val,
-                       mi->oc_monitorCounterObject->soc_cname.bv_val );
+                       mi->oc_monitorCounterObject->soc_cname.bv_val,
+                       mi->mi_startTime.bv_val,
+                       mi->mi_startTime.bv_val );
 
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -140,10 +144,14 @@ monitor_subsys_sent_init(
                        "dn: cn=Referrals,%s\n"
                        "objectClass: %s\n"
                        "structuralObjectClass: %s\n"
-                       "cn: Referrals\n",
+                       "cn: Referrals\n"
+                       "createTimestamp: %s\n"
+                       "modifyTimestamp: %s\n",
                        monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
                        mi->oc_monitorCounterObject->soc_cname.bv_val,
-                       mi->oc_monitorCounterObject->soc_cname.bv_val );
+                       mi->oc_monitorCounterObject->soc_cname.bv_val,
+                       mi->mi_startTime.bv_val,
+                       mi->mi_startTime.bv_val );
 
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -199,10 +207,14 @@ monitor_subsys_sent_init(
                        "dn: cn=PDU,%s\n"
                        "objectClass: %s\n"
                        "structuralObjectClass: %s\n"
-                       "cn: PDU\n",
+                       "cn: PDU\n"
+                       "createTimestamp: %s\n"
+                       "modifyTimestamp: %s\n",
                        monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
                        mi->oc_monitorCounterObject->soc_cname.bv_val,
-                       mi->oc_monitorCounterObject->soc_cname.bv_val );
+                       mi->oc_monitorCounterObject->soc_cname.bv_val,
+                       mi->mi_startTime.bv_val,
+                       mi->mi_startTime.bv_val );
 
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -258,10 +270,14 @@ monitor_subsys_sent_init(
                        "dn: cn=Bytes,%s\n"
                        "objectClass: %s\n"
                        "structuralObjectClass: %s\n"
-                       "cn: Bytes\n",
+                       "cn: Bytes\n"
+                       "createTimestamp: %s\n"
+                       "modifyTimestamp: %s\n",
                        monitor_subsys[SLAPD_MONITOR_SENT].mss_dn.bv_val,
                        mi->oc_monitorCounterObject->soc_cname.bv_val,
-                       mi->oc_monitorCounterObject->soc_cname.bv_val );
+                       mi->oc_monitorCounterObject->soc_cname.bv_val,
+                       mi->mi_startTime.bv_val,
+                       mi->mi_startTime.bv_val );
 
        e = str2entry( buf );
        if ( e == NULL ) {
index 0a94519c9f8da7a185f699eb1f8aec2722715c49..544e39f85b17bd8cfb25cd7bc10075ceedb13ad0 100644 (file)
 #include "proto-slap.h"
 #include "back-monitor.h"
 
-#ifdef HACK_LOCAL_TIME
-static int
-local_time( const struct tm *ztm, long delta, char *buf, size_t len );
-#endif /* HACK_LOCAL_TIME */
-
 int
 monitor_subsys_time_init(
        BackendDB               *be
@@ -58,12 +53,6 @@ monitor_subsys_time_init(
        Entry                   *e, *e_tmp, *e_time;
        struct monitorentrypriv *mp;
        char                    buf[ BACKMONITOR_BUFSIZE ];
-       struct tm               *tms;
-       char                    tmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
-
-       /*
-        * Note: ltmbuf, ltm are used only if HACK_LOCAL_TIME is defined
-        */
 
        assert( be != NULL );
 
@@ -88,28 +77,21 @@ monitor_subsys_time_init(
 
        e_tmp = NULL;
 
-       /*
-        * Start
-        */
-       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
-#ifdef HACK_LOCAL_TIME
-       tms = localtime( &starttime );
-       local_time( tms, -timezone, tmbuf, sizeof( tmbuf ) );
-#else /* !HACK_LOCAL_TIME */
-       tms = gmtime( &starttime );
-       lutil_gentime( tmbuf, sizeof(tmbuf), tms );
-#endif /* !HACK_LOCAL_TIME */
-       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
        snprintf( buf, sizeof( buf ),
                        "dn: cn=Start,%s\n"
                        "objectClass: %s\n"
                        "structuralObjectClass: %s\n"
                        "cn: Start\n"
-                       "createTimestamp: %s", 
+                       "%s: %s\n"
+                       "createTimestamp: %s\n"
+                       "modifyTimestamp: %s\n", 
                        monitor_subsys[SLAPD_MONITOR_TIME].mss_dn.bv_val,
                        mi->oc_monitoredObject->soc_cname.bv_val,
                        mi->oc_monitoredObject->soc_cname.bv_val,
-                       tmbuf );
+                       mi->ad_monitorTimestamp->ad_cname.bv_val,
+                       mi->mi_startTime.bv_val,
+                       mi->mi_startTime.bv_val,
+                       mi->mi_startTime.bv_val );
 
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -162,12 +144,16 @@ monitor_subsys_time_init(
                        "objectClass: %s\n"
                        "structuralObjectClass: %s\n"
                        "cn: Current\n"
+                       "%s: %s\n"
                        "createTimestamp: %s\n"
                        "modifyTimestamp: %s\n",
                        monitor_subsys[SLAPD_MONITOR_TIME].mss_dn.bv_val,
                        mi->oc_monitoredObject->soc_cname.bv_val,
                        mi->oc_monitoredObject->soc_cname.bv_val,
-                       tmbuf, tmbuf );
+                       mi->ad_monitorTimestamp->ad_cname.bv_val,
+                       mi->mi_startTime.bv_val,
+                       mi->mi_startTime.bv_val,
+                       mi->mi_startTime.bv_val );
 
        e = str2entry( buf );
        if ( e == NULL ) {
@@ -227,115 +213,41 @@ monitor_subsys_time_update(
 )
 {
        struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private;
-       char            stmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ],
-                       ctmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
-       struct tm       *stm, *ctm;
-       Attribute       *a;
-       ber_len_t       len;
-
-       static int      init_start = 0, init_current = 0;
-#define ENTRY_TIME     0
-#define ENTRY_START    1
-#define ENTRY_CURRENT  2
-       int             entry = ENTRY_TIME;
 
        assert( mi );
        assert( e );
        
-       if ( strncmp( e->e_nname.bv_val, "cn=start", 
-                               sizeof("cn=start")-1 ) == 0 ) {
-               entry = ENTRY_START;
-               if ( init_start == 1 ) {
-                       return( 0 );
-               }
+       if ( strncmp( e->e_nname.bv_val, "cn=current",
+                               sizeof("cn=current") - 1 ) == 0 ) {
+               struct tm       *tm;
+               char            tmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
+               Attribute       *a;
+               ber_len_t       len;
+               time_t          currtime;
 
-       } else if ( strncmp( e->e_nname.bv_val, "cn=current",
-                               sizeof("cn=current")-1 ) == 0 ) {
-               entry = ENTRY_CURRENT;
-       }
-       
-       ldap_pvt_thread_mutex_lock( &gmtime_mutex );
-       if ( init_start == 0 ) {
-#ifdef HACK_LOCAL_TIME
-               stm = localtime( &starttime );
-               local_time( stm, -timezone, stmbuf, sizeof( stmbuf ) );
-#else /* !HACK_LOCAL_TIME */
-               stm = gmtime( &starttime );
-               lutil_gentime( stmbuf, sizeof( stmbuf ), stm );
-#endif /* !HACK_LOCAL_TIME */
-       }
+               currtime = slap_get_time();
 
-       if ( entry == ENTRY_CURRENT ) {
-               time_t currentTime = slap_get_time();
+               ldap_pvt_thread_mutex_lock( &gmtime_mutex );
 #ifdef HACK_LOCAL_TIME
-               ctm = localtime( &currentTime );
-               local_time( ctm, -timezone, ctmbuf, sizeof( ctmbuf ) );
+               tm = localtime( &currtime );
+               lutil_localtime( tmbuf, sizeof( tmbuf ), tm, -timezone );
 #else /* !HACK_LOCAL_TIME */
-               ctm = gmtime( &currentTime );
-               lutil_gentime( ctmbuf, sizeof( ctmbuf ), ctm );
+               tm = gmtime( &currtime );
+               lutil_gentime( tmbuf, sizeof( tmbuf ), tm );
 #endif /* !HACK_LOCAL_TIME */
-       }
-       ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
+               ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 
-       if ( ( entry == ENTRY_START && init_start == 0 ) 
-                       || ( entry == ENTRY_CURRENT && init_current == 0 ) ) {
-               a = attr_find( e->e_attrs, slap_schema.si_ad_createTimestamp );
-               if ( a == NULL ) {
-                       return( -1 );
-               }
-
-               len = strlen( stmbuf );
-               assert( len == a->a_vals[0].bv_len );
-               AC_MEMCPY( a->a_vals[0].bv_val, stmbuf, len );
-
-               if ( entry == ENTRY_START ) {
-                       init_start = 1;
-               } else if ( entry == ENTRY_CURRENT ) {
-                       init_current = 1;
-               }
-       }
+               len = strlen( tmbuf );
 
-       if ( entry == ENTRY_CURRENT ) {
-               a = attr_find( e->e_attrs, slap_schema.si_ad_modifyTimestamp );
+               a = attr_find( e->e_attrs, mi->ad_monitorTimestamp );
                if ( a == NULL ) {
                        return( -1 );
                }
 
-               len = strlen( ctmbuf );
                assert( len == a->a_vals[0].bv_len );
-               AC_MEMCPY( a->a_vals[0].bv_val, ctmbuf, len );
+               AC_MEMCPY( a->a_vals[0].bv_val, tmbuf, len );
        }
 
        return( 0 );
 }
 
-#ifdef HACK_LOCAL_TIME
-/*
- * assumes gmtime_mutex is locked
- */
-static int
-local_time( const struct tm *ltm, long delta, char *buf, size_t len )
-{
-       char *p;
-
-       if ( len < 20 ) {
-               return -1;
-       }
-       strftime( buf, len, "%Y%m%d%H%M%S", ltm );
-
-       p = buf + 14;
-
-       if ( delta < 0 ) {
-               p[ 0 ] = '-';
-               delta = -delta;
-       } else {
-               p[ 0 ] = '+';
-       }
-       p++;
-
-       snprintf( p, len - 15, "%02ld%02ld", delta / 3600, delta % 3600 );
-       
-       return 0;
-}
-#endif /* HACK_LOCAL_TIME */
-