Skip to content

Commit

Permalink
[db datetime parsing] parse only date if date-time format parsing fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ionutrazvanionita authored and razvancrainea committed Nov 22, 2017
1 parent a485de0 commit 493bbec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion db/db_ut.c
Expand Up @@ -188,7 +188,8 @@ inline int db_str2time(const char* _s, time_t* _v)
/* Convert database time representation to time_t structure
It is necessary to zero tm structure first */
memset(&time, '\0', sizeof(struct tm));
if (strptime(_s, "%Y-%m-%d %H:%M:%S", &time) == NULL) {
if (strptime(_s, "%Y-%m-%d %H:%M:%S", &time) == NULL &&
strptime(_s, "%Y-%m-%d", &time) == NULL) {
LM_ERR("Error during time conversion\n");
return -1;
}
Expand Down

0 comments on commit 493bbec

Please sign in to comment.