X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fmonitor.c;h=595095d86670f146ad9a61d6ebf5606010e8351b;hb=1c0b433a25744ff9f23e7c4322510f36692a7c77;hp=07ead7445d85224b1d2a07029601958aa3ca3703;hpb=860038cff14e03dc74ada45e030e6161ba5d2a0d;p=openldap diff --git a/servers/slapd/monitor.c b/servers/slapd/monitor.c index 07ead7445d..595095d866 100644 --- a/servers/slapd/monitor.c +++ b/servers/slapd/monitor.c @@ -49,7 +49,7 @@ void monitor_info( Connection *conn, Operation *op ) { Entry *e; - char buf[BUFSIZ], buf2[20]; + char buf[BUFSIZ], buf2[22]; struct berval val; struct berval *vals[2]; int i, nconns, nwritewaiters, nreadwaiters; @@ -60,6 +60,8 @@ monitor_info( Connection *conn, Operation *op ) vals[1] = NULL; e = (Entry *) ch_calloc( 1, sizeof(Entry) ); + /* initialize reader/writer lock */ + entry_rdwr_init(e); e->e_attrs = NULL; e->e_dn = strdup( SLAPD_MONITOR_DN ); @@ -91,8 +93,13 @@ monitor_info( Connection *conn, Operation *op ) nreadwaiters++; } pthread_mutex_lock( ¤ttime_mutex ); +#ifndef LDAP_LOCALTIME + ltm = gmtime( &c[i].c_starttime ); + strftime( buf2, sizeof(buf2), "%Y%m%d%H%M%SZ", ltm ); +#else ltm = localtime( &c[i].c_starttime ); strftime( buf2, sizeof(buf2), "%y%m%d%H%M%SZ", ltm ); +#endif pthread_mutex_unlock( ¤ttime_mutex ); pthread_mutex_lock( &c[i].c_dnmutex ); @@ -155,16 +162,26 @@ monitor_info( Connection *conn, Operation *op ) attr_merge( e, "bytessent", vals ); pthread_mutex_lock( ¤ttime_mutex ); - ltm = localtime( ¤ttime ); - strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm ); +#ifndef LDAP_LOCALTIME + ltm = gmtime( ¤ttime ); + strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm ); +#else + ltm = localtime( ¤ttime ); + strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm ); +#endif pthread_mutex_unlock( ¤ttime_mutex ); val.bv_val = buf; val.bv_len = strlen( buf ); attr_merge( e, "currenttime", vals ); pthread_mutex_lock( ¤ttime_mutex ); - ltm = localtime( &starttime ); - strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm ); +#ifndef LDAP_LOCALTIME + ltm = gmtime( &starttime ); + strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm ); +#else + ltm = localtime( &starttime ); + strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm ); +#endif pthread_mutex_unlock( ¤ttime_mutex ); val.bv_val = buf; val.bv_len = strlen( buf );