projects
/
services
/
createrepo_c.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3fd1fa5
)
fix traceback on non-complete datetime information
author
Jarek Polok
<Jaroslaw.Polok@cern.ch>
Thu, 17 Sep 2015 11:37:02 +0000
(13:37 +0200)
committer
Jarek Polok
<Jaroslaw.Polok@cern.ch>
Thu, 17 Sep 2015 11:37:02 +0000
(13:37 +0200)
src/python/updaterecord-py.c
patch
|
blob
|
history
diff --git
a/src/python/updaterecord-py.c
b/src/python/updaterecord-py.c
index 13d5e3fe062c96c807c22aff6de312ea18c5535e..f4296e623f2a096188489f40dbd72dcbb561414c 100644
(file)
--- a/
src/python/updaterecord-py.c
+++ b/
src/python/updaterecord-py.c
@@
-274,9
+274,12
@@
get_datetime(_UpdateRecordObject *self, void *member_offset)
struct tm *dt = malloc(sizeof(struct tm));
char *res = strptime(str, "%Y-%m-%d %H:%M:%S", dt);
- if (res == NULL)
- PyErr_SetString(CrErr_Exception, "Invalid date");
-
+ if (res == NULL) {
+ memset(res,0,sizeof(dt));
+ res = strptime(str, "%Y-%m-%d", dt);
+ if (res == NULL)
+ PyErr_SetString(CrErr_Exception, "Invalid date");
+ }
PyObject *py_dt = PyDateTime_FromDateAndTime(dt->tm_year + 1900,
dt->tm_mon + 1, dt->tm_mday,
dt->tm_hour, dt->tm_min, dt->tm_sec, 0);