mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
r576: added a ldap_timestring() function (needed for fields like whenChanged in SAM db)
(This used to be commit b2a63555189fea41184a2cac796945bca4e98995)
This commit is contained in:
parent
2fdf5d332d
commit
62e9106086
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
|
Loading…
x
Reference in New Issue
Block a user