1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

r576: added a ldap_timestring() function (needed for fields like whenChanged in SAM db)

This commit is contained in:
Andrew Tridgell
2004-05-07 23:56:57 +00:00
committed by Gerald (Jerry) Carter
parent 2cb06b39d9
commit b2a6355518

View File

@ -339,6 +339,25 @@ char *http_timestring(TALLOC_CTX *mem_ctx, time_t t)
return buf;
}
/***************************************************************************
return a LDAP time string
***************************************************************************/
char *ldap_timestring(TALLOC_CTX *mem_ctx, time_t t)
{
struct tm *tm = gmtime(&t);
if (!tm) {
return NULL;
}
/* formatted like: 20040408072012.0Z */
return talloc_asprintf(mem_ctx,
"%04u%02u%02u%02u%02u%02u.0Z",
tm->tm_year+1900, tm->tm_mon+1,
tm->tm_mday, tm->tm_hour, tm->tm_min,
tm->tm_sec);
}
/****************************************************************************