Skip to content

Commit 83fb1ee

Browse files
committed
Avoid exposing twin_now
twin_now() should be used as an internal function for tracking timeout events.
1 parent 545945c commit 83fb1ee

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

include/twin.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,16 +1005,12 @@ void twin_path_curve(twin_path_t *path,
10051005
* timeout.c
10061006
*/
10071007

1008-
#define twin_time_compare(a, op, b) (((a) - (b)) op 0)
1009-
10101008
twin_timeout_t *twin_set_timeout(twin_timeout_proc_t timeout_proc,
10111009
twin_time_t delay,
10121010
void *closure);
10131011

10141012
void twin_clear_timeout(twin_timeout_t *timeout);
10151013

1016-
twin_time_t twin_now(void);
1017-
10181014
/*
10191015
* toplevel.c
10201016
*/

src/timeout.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,20 @@
55
*/
66

77
#include <stdlib.h>
8+
#include <sys/time.h>
9+
#include <time.h>
810

911
#include "twin_private.h"
1012

13+
#define twin_time_compare(a, op, b) (((a) - (b)) op 0)
14+
15+
static twin_time_t twin_now(void)
16+
{
17+
struct timeval tv;
18+
gettimeofday(&tv, NULL);
19+
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
20+
}
21+
1122
static twin_queue_t *head;
1223
static twin_time_t start;
1324

@@ -82,13 +93,3 @@ twin_time_t _twin_timeout_delay(void)
8293
}
8394
return -1;
8495
}
85-
86-
#include <sys/time.h>
87-
#include <time.h>
88-
89-
twin_time_t twin_now(void)
90-
{
91-
struct timeval tv;
92-
gettimeofday(&tv, NULL);
93-
return tv.tv_sec * 1000 + tv.tv_usec / 1000;
94-
}

0 commit comments

Comments
 (0)