mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
#ifdef local time hack
This commit is contained in:
parent
33516fa9eb
commit
2d1eb56725
@ -56,6 +56,10 @@ monitor_subsys_time_init(
|
|||||||
char buf[1024], ztmbuf[20], ltmbuf[20];
|
char buf[1024], ztmbuf[20], ltmbuf[20];
|
||||||
struct tm *ztm, *ltm;
|
struct tm *ztm, *ltm;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: ltmbuf, ltm are used only if HACK_LOCAL_TIME is defined
|
||||||
|
*/
|
||||||
|
|
||||||
assert( be != NULL );
|
assert( be != NULL );
|
||||||
|
|
||||||
mi = ( struct monitorinfo * )be->be_private;
|
mi = ( struct monitorinfo * )be->be_private;
|
||||||
@ -85,17 +89,25 @@ monitor_subsys_time_init(
|
|||||||
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
|
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
|
||||||
ztm = gmtime( &starttime );
|
ztm = gmtime( &starttime );
|
||||||
strftime( ztmbuf, sizeof(ztmbuf), "%Y%m%d%H%M%SZ", ztm );
|
strftime( ztmbuf, sizeof(ztmbuf), "%Y%m%d%H%M%SZ", ztm );
|
||||||
|
#ifdef HACK_LOCAL_TIME
|
||||||
ltm = localtime( &starttime );
|
ltm = localtime( &starttime );
|
||||||
local_time( ltm, -timezone, ltmbuf, sizeof( ltmbuf ) );
|
local_time( ltm, -timezone, ltmbuf, sizeof( ltmbuf ) );
|
||||||
|
#endif /* HACK_LOCAL_TIME */
|
||||||
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
|
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
|
||||||
snprintf( buf, sizeof( buf ),
|
snprintf( buf, sizeof( buf ),
|
||||||
"dn: cn=Start,%s\n"
|
"dn: cn=Start,%s\n"
|
||||||
SLAPD_MONITOR_OBJECTCLASSES
|
SLAPD_MONITOR_OBJECTCLASSES
|
||||||
"cn: Start\n"
|
"cn: Start\n"
|
||||||
"description: %s\n"
|
"description: %s\n"
|
||||||
"description;lang-x-local: %s",
|
#ifdef HACK_LOCAL_TIME
|
||||||
monitor_subsys[SLAPD_MONITOR_TIME].mss_dn.bv_val,
|
"description;lang-x-local: %s"
|
||||||
ztmbuf, ltmbuf );
|
#endif /* HACK_LOCAL_TIME */
|
||||||
|
, monitor_subsys[SLAPD_MONITOR_TIME].mss_dn.bv_val,
|
||||||
|
ztmbuf
|
||||||
|
#ifdef HACK_LOCAL_TIME
|
||||||
|
, ltmbuf
|
||||||
|
#endif /* HACK_LOCAL_TIME */
|
||||||
|
);
|
||||||
|
|
||||||
e = str2entry( buf );
|
e = str2entry( buf );
|
||||||
if ( e == NULL ) {
|
if ( e == NULL ) {
|
||||||
@ -148,9 +160,15 @@ monitor_subsys_time_init(
|
|||||||
SLAPD_MONITOR_OBJECTCLASSES
|
SLAPD_MONITOR_OBJECTCLASSES
|
||||||
"cn: Current\n"
|
"cn: Current\n"
|
||||||
"description: %s\n"
|
"description: %s\n"
|
||||||
"description;lang-x-local: %s",
|
#ifdef HACK_LOCAL_TIME
|
||||||
monitor_subsys[SLAPD_MONITOR_TIME].mss_dn.bv_val,
|
"description;lang-x-local: %s"
|
||||||
ztmbuf, ltmbuf );
|
#endif /* HACK_LOCAL_TIME */
|
||||||
|
, monitor_subsys[SLAPD_MONITOR_TIME].mss_dn.bv_val,
|
||||||
|
ztmbuf
|
||||||
|
#ifdef HACK_LOCAL_TIME
|
||||||
|
, ltmbuf
|
||||||
|
#endif /* HACK_LOCAL_TIME */
|
||||||
|
);
|
||||||
|
|
||||||
e = str2entry( buf );
|
e = str2entry( buf );
|
||||||
if ( e == NULL ) {
|
if ( e == NULL ) {
|
||||||
@ -219,6 +237,11 @@ monitor_subsys_time_update(
|
|||||||
|
|
||||||
static int init_start = 0;
|
static int init_start = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: ltmbuf, ltm, ad_local, text are used only if HACK_LOCAL_TIME
|
||||||
|
* is defined
|
||||||
|
*/
|
||||||
|
|
||||||
assert( mi );
|
assert( mi );
|
||||||
assert( e );
|
assert( e );
|
||||||
|
|
||||||
@ -238,8 +261,10 @@ monitor_subsys_time_update(
|
|||||||
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
|
ldap_pvt_thread_mutex_lock( &gmtime_mutex );
|
||||||
ztm = gmtime( ¤ttime );
|
ztm = gmtime( ¤ttime );
|
||||||
strftime( ztmbuf, sizeof( ztmbuf ), "%Y%m%d%H%M%SZ", ztm );
|
strftime( ztmbuf, sizeof( ztmbuf ), "%Y%m%d%H%M%SZ", ztm );
|
||||||
|
#ifdef HACK_LOCAL_TIME
|
||||||
ltm = localtime( ¤ttime );
|
ltm = localtime( ¤ttime );
|
||||||
local_time( ltm, -timezone, ltmbuf, sizeof( ltmbuf ) );
|
local_time( ltm, -timezone, ltmbuf, sizeof( ltmbuf ) );
|
||||||
|
#endif /* HACK_LOCAL_TIME */
|
||||||
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
|
ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
|
||||||
|
|
||||||
a = attr_find( e->e_attrs, monitor_ad_desc );
|
a = attr_find( e->e_attrs, monitor_ad_desc );
|
||||||
@ -251,6 +276,7 @@ monitor_subsys_time_update(
|
|||||||
assert( len == a->a_vals[0].bv_len );
|
assert( len == a->a_vals[0].bv_len );
|
||||||
AC_MEMCPY( a->a_vals[0].bv_val, ztmbuf, len );
|
AC_MEMCPY( a->a_vals[0].bv_val, ztmbuf, len );
|
||||||
|
|
||||||
|
#ifdef HACK_LOCAL_TIME
|
||||||
if ( ad_local == NULL ) {
|
if ( ad_local == NULL ) {
|
||||||
if ( slap_str2ad( "description;lang-x-local",
|
if ( slap_str2ad( "description;lang-x-local",
|
||||||
&ad_local, &text ) != LDAP_SUCCESS ) {
|
&ad_local, &text ) != LDAP_SUCCESS ) {
|
||||||
@ -265,6 +291,7 @@ monitor_subsys_time_update(
|
|||||||
len = strlen( ltmbuf );
|
len = strlen( ltmbuf );
|
||||||
assert( len == a->a_vals[0].bv_len );
|
assert( len == a->a_vals[0].bv_len );
|
||||||
AC_MEMCPY( a->a_vals[0].bv_val, ltmbuf, len );
|
AC_MEMCPY( a->a_vals[0].bv_val, ltmbuf, len );
|
||||||
|
#endif /* HACK_LOCAL_TIME */
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user