Skip to content

Commit 67247c0

Browse files
committed
transfer tfw_current_timestamp() in the library
1 parent ab9a43a commit 67247c0

File tree

4 files changed

+34
-9
lines changed

4 files changed

+34
-9
lines changed

lib/common.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Tempesta kernel library
3+
*
4+
* Copyright (C) 2019 Tempesta Technologies, Inc.
5+
*
6+
* This program is free software; you can redistribute it and/or modify it
7+
* under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation; either version 2 of the License,
9+
* or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful, but WITHOUT
12+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
* FITNESS FOR A PARTICULAR PURPOSE.
14+
* See the GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License along with
17+
* this program; if not, write to the Free Software Foundation, Inc., 59
18+
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19+
*/
20+
#ifndef __LIB_COMMON_H__
21+
#define __LIB_COMMON_H__
22+
23+
/* Get current timestamp in secs. */
24+
static inline time_t
25+
tfw_current_timestamp(void)
26+
{
27+
struct timespec ts;
28+
getnstimeofday(&ts);
29+
return ts.tv_sec;
30+
}
31+
32+
#endif /* __LIB_COMMON_H__ */

tempesta_fw/cache.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "procfs.h"
3838
#include "sync_socket.h"
3939
#include "work_queue.h"
40+
#include "lib/common.h"
4041

4142
#if MAX_NUMNODES > ((1 << 16) - 1)
4243
#warning "Please set CONFIG_NODES_SHIFT to less than 16"

tempesta_fw/http.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "apm.h"
4040

4141
#include "sync_socket.h"
42+
#include "lib/common.h"
4243

4344
#define TFW_WARN_ADDR_STATUS(msg, addr_ptr, print_port, status) \
4445
TFW_WITH_ADDR_FMT(addr_ptr, print_port, addr_str, \

tempesta_fw/http.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -490,15 +490,6 @@ enum {
490490
#define HTTP_CODE_MAX 599
491491
#define HTTP_CODE_BIT_NUM(code) ((code) - HTTP_CODE_MIN)
492492

493-
/* Get current timestamp in secs. */
494-
static inline time_t
495-
tfw_current_timestamp(void)
496-
{
497-
struct timespec ts;
498-
getnstimeofday(&ts);
499-
return ts.tv_sec;
500-
}
501-
502493
static inline int
503494
tfw_http_resp_code_range(const int n)
504495
{

0 commit comments

Comments
 (0)