add create/modify timestamp to all entries; use monitorTimestamp for start/current time; minor cleanup

This commit is contained in:
Pierangelo Masarati 2003-05-15 01:19:30 +00:00
parent 0b5691f122
commit 48c65151c9
11 changed files with 184 additions and 168 deletions

View 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

View 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 ) {

View 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) {

View 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 ) {

View 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

View 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 ) {

View 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 ) {

View 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;

View 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 );

View 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 ) {

View File

@ -43,11 +43,6 @@
#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 ) {
currtime = slap_get_time();
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
#ifdef HACK_LOCAL_TIME
stm = localtime( &starttime );
local_time( stm, -timezone, stmbuf, sizeof( stmbuf ) );
tm = localtime( &currtime );
lutil_localtime( tmbuf, sizeof( tmbuf ), tm, -timezone );
#else /* !HACK_LOCAL_TIME */
stm = gmtime( &starttime );
lutil_gentime( stmbuf, sizeof( stmbuf ), stm );
tm = gmtime( &currtime );
lutil_gentime( tmbuf, sizeof( tmbuf ), tm );
#endif /* !HACK_LOCAL_TIME */
}
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
if ( entry == ENTRY_CURRENT ) {
time_t currentTime = slap_get_time();
#ifdef HACK_LOCAL_TIME
ctm = localtime( &currentTime );
local_time( ctm, -timezone, ctmbuf, sizeof( ctmbuf ) );
#else /* !HACK_LOCAL_TIME */
ctm = gmtime( &currentTime );
lutil_gentime( ctmbuf, sizeof( ctmbuf ), ctm );
#endif /* !HACK_LOCAL_TIME */
}
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
len = strlen( tmbuf );
if ( ( entry == ENTRY_START && init_start == 0 )
|| ( entry == ENTRY_CURRENT && init_current == 0 ) ) {
a = attr_find( e->e_attrs, slap_schema.si_ad_createTimestamp );
a = attr_find( e->e_attrs, mi->ad_monitorTimestamp );
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;
}
}
if ( entry == ENTRY_CURRENT ) {
a = attr_find( e->e_attrs, slap_schema.si_ad_modifyTimestamp );
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 */