diff options
Diffstat (limited to 'main/stdtime')
-rw-r--r-- | main/stdtime/localtime.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/main/stdtime/localtime.c b/main/stdtime/localtime.c index b25b8ab14..389107cb7 100644 --- a/main/stdtime/localtime.c +++ b/main/stdtime/localtime.c @@ -1819,3 +1819,15 @@ defcase: *fptr++ = *tmp; return res; } +char *ast_strptime(const char *s, const char *format, struct ast_tm *tm) +{ + struct tm tm2 = { 0, }; + char *res = strptime(s, format, &tm2); + memcpy(tm, &tm2, sizeof(*tm)); + tm->tm_usec = 0; + /* strptime(3) doesn't set .tm_isdst correctly, so to force ast_mktime(3) + * to deal with it correctly, we set it to -1. */ + tm->tm_isdst = -1; + return res; +} + |