/* use this macro to statically allocate buffer for lutil_gentime */
#define LDAP_LUTIL_GENTIME_BUFSIZE 22
+#define lutil_gentime(s,m,t) lutil_localtime((s),(m),(t),0)
LDAP_LUTIL_F( size_t )
-lutil_gentime LDAP_P(( char *s, size_t max, const struct tm *tm ));
+lutil_localtime LDAP_P(( char *s, size_t smax, const struct tm *tm,
+ long delta ));
#ifndef HAVE_MKSTEMP
LDAP_LUTIL_F( int )
return progname;
}
+#if 0
size_t lutil_gentime( char *s, size_t smax, const struct tm *tm )
{
-#if 0
size_t ret;
#ifdef HAVE_EBCDIC
/* We've been compiling in ASCII so far, but we want EBCDIC now since
__etoa( s );
#endif
return ret;
-#else
- return lutil_localtime( s, smax, tm, 0 );
-#endif
}
+#endif
size_t lutil_localtime( char *s, size_t smax, const struct tm *tm, long delta )
{
size_t ret;
char *p;
- if ( smax < 20 ) {
- return -1;
+ if ( smax < 16 ) { /* YYYYmmddHHMMSSZ */
+ return 0;
}
#ifdef HAVE_EBCDIC
#pragma convlit(suspend)
#endif
ret = strftime( s, smax, "%Y%m%d%H%M%SZ", tm );
- if ( ret == 0 ) {
+ if ( delta == 0 || ret == 0 ) {
return ret;
}
- if ( delta == 0 ) {
- return ret;
+ if ( smax < 20 ) { /* YYYYmmddHHMMSS+HHMM */
+ return 0;
}
p = s + 14;