summaryrefslogtreecommitdiffstats
path: root/src/lua/lua_task.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lua/lua_task.c')
-rw-r--r--src/lua/lua_task.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 21780cb9f..6a904352f 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -5042,19 +5042,27 @@ lua_task_get_date (lua_State *L)
if (h) {
time_t tt;
struct tm t;
+ GError *err = NULL;
- tt = rspamd_parse_smtp_date (h->decoded, strlen (h->decoded));
+ tt = rspamd_parse_smtp_date (h->decoded, strlen (h->decoded),
+ &err);
- if (!gmt) {
- rspamd_localtime (tt, &t);
+ if (err == NULL) {
+ if (!gmt) {
+ rspamd_localtime (tt, &t);
#if !defined(__sun)
- t.tm_gmtoff = 0;
+ t.tm_gmtoff = 0;
#endif
- t.tm_isdst = 0;
- tim = mktime (&t);
+ t.tm_isdst = 0;
+ tim = mktime (&t);
+ }
+ else {
+ tim = tt;
+ }
}
else {
- tim = tt;
+ g_error_free (err);
+ tim = 0.0;
}
}
else {