aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_util.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-07-01 14:28:08 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-07-01 14:28:08 +0100
commit4bd0eb5511a3913e03962c79f72f5a54f8bb8a72 (patch)
tree3c614b6e49119ec0791e044c3af39c48195b6a48 /src/lua/lua_util.c
parentf8004be4c94ca214cd399cdb18aa0d085abf0fd7 (diff)
downloadrspamd-4bd0eb5511a3913e03962c79f72f5a54f8bb8a72.tar.gz
rspamd-4bd0eb5511a3913e03962c79f72f5a54f8bb8a72.zip
[Minor] Refrain from gettimeofday direct usage
Diffstat (limited to 'src/lua/lua_util.c')
-rw-r--r--src/lua/lua_util.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/lua/lua_util.c b/src/lua/lua_util.c
index 4eaf7b672..f385b3ef2 100644
--- a/src/lua/lua_util.c
+++ b/src/lua/lua_util.c
@@ -1739,17 +1739,8 @@ static gint
lua_util_get_time (lua_State *L)
{
LUA_TRACE_POINT;
- gdouble seconds;
- struct timeval tv;
-
- if (gettimeofday (&tv, NULL) == 0) {
- seconds = tv_to_double (&tv);
- }
- else {
- seconds = time (NULL);
- }
- lua_pushnumber (L, seconds);
+ lua_pushnumber (L, ev_time ());
return 1;
}
@@ -1759,19 +1750,13 @@ lua_util_time_to_string (lua_State *L)
{
LUA_TRACE_POINT;
gdouble seconds;
- struct timeval tv;
char timebuf[128];
if (lua_isnumber (L, 1)) {
seconds = lua_tonumber (L, 1);
}
else {
- if (gettimeofday (&tv, NULL) == 0) {
- seconds = tv_to_double (&tv);
- }
- else {
- seconds = time (NULL);
- }
+ seconds = ev_time ();
}
rspamd_http_date_format (timebuf, sizeof (timebuf), seconds);