mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Turn the wallclock module into a subsystem.
(This may be slightly gratuitous.)
This commit is contained in:
parent
d3e4afcc9b
commit
a0ee54549f
@ -1394,7 +1394,6 @@ tor_run_main(const tor_main_configuration_t *tor_cfg)
|
|||||||
|
|
||||||
init_protocol_warning_severity_level();
|
init_protocol_warning_severity_level();
|
||||||
|
|
||||||
update_approx_time(time(NULL));
|
|
||||||
tor_compress_init();
|
tor_compress_init();
|
||||||
monotime_init();
|
monotime_init();
|
||||||
|
|
||||||
|
@ -9,9 +9,10 @@
|
|||||||
#include "lib/cc/torint.h"
|
#include "lib/cc/torint.h"
|
||||||
|
|
||||||
#include "lib/err/torerr_sys.h"
|
#include "lib/err/torerr_sys.h"
|
||||||
|
#include "lib/log/log_sys.h"
|
||||||
#include "lib/process/winprocess_sys.h"
|
#include "lib/process/winprocess_sys.h"
|
||||||
#include "lib/thread/thread_sys.h"
|
#include "lib/thread/thread_sys.h"
|
||||||
#include "lib/log/log_sys.h"
|
#include "lib/wallclock/wallclock_sys.h"
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
@ -21,6 +22,7 @@
|
|||||||
const subsys_fns_t *tor_subsystems[] = {
|
const subsys_fns_t *tor_subsystems[] = {
|
||||||
&sys_winprocess,
|
&sys_winprocess,
|
||||||
&sys_torerr,
|
&sys_torerr,
|
||||||
|
&sys_wallclock,
|
||||||
&sys_threads,
|
&sys_threads,
|
||||||
&sys_logging,
|
&sys_logging,
|
||||||
};
|
};
|
||||||
|
@ -3,4 +3,5 @@ lib/cc/*.h
|
|||||||
lib/err/*.h
|
lib/err/*.h
|
||||||
lib/wallclock/*.h
|
lib/wallclock/*.h
|
||||||
lib/string/*.h
|
lib/string/*.h
|
||||||
|
lib/subsys/*.h
|
||||||
lib/testsupport/*.h
|
lib/testsupport/*.h
|
||||||
|
@ -9,7 +9,9 @@
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
#include "orconfig.h"
|
#include "orconfig.h"
|
||||||
|
#include "lib/subsys/subsys.h"
|
||||||
#include "lib/wallclock/approx_time.h"
|
#include "lib/wallclock/approx_time.h"
|
||||||
|
#include "lib/wallclock/wallclock_sys.h"
|
||||||
|
|
||||||
/* =====
|
/* =====
|
||||||
* Cached time
|
* Cached time
|
||||||
@ -41,3 +43,17 @@ update_approx_time(time_t now)
|
|||||||
cached_approx_time = now;
|
cached_approx_time = now;
|
||||||
}
|
}
|
||||||
#endif /* !defined(TIME_IS_FAST) */
|
#endif /* !defined(TIME_IS_FAST) */
|
||||||
|
|
||||||
|
static int
|
||||||
|
init_wallclock_subsys(void)
|
||||||
|
{
|
||||||
|
update_approx_time(time(NULL));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const subsys_fns_t sys_wallclock = {
|
||||||
|
.name = "wallclock",
|
||||||
|
.supported = true,
|
||||||
|
.level = -99,
|
||||||
|
.initialize = init_wallclock_subsys,
|
||||||
|
};
|
||||||
|
@ -19,4 +19,5 @@ noinst_HEADERS += \
|
|||||||
src/lib/wallclock/approx_time.h \
|
src/lib/wallclock/approx_time.h \
|
||||||
src/lib/wallclock/timeval.h \
|
src/lib/wallclock/timeval.h \
|
||||||
src/lib/wallclock/time_to_tm.h \
|
src/lib/wallclock/time_to_tm.h \
|
||||||
src/lib/wallclock/tor_gettimeofday.h
|
src/lib/wallclock/tor_gettimeofday.h \
|
||||||
|
src/lib/wallclock/wallclock_sys.h
|
||||||
|
14
src/lib/wallclock/wallclock_sys.h
Normal file
14
src/lib/wallclock/wallclock_sys.h
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/* Copyright (c) 2018, The Tor Project, Inc. */
|
||||||
|
/* See LICENSE for licensing information */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file wallclock_sys.h
|
||||||
|
* \brief Declare subsystem object for the wallclock module.
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef TOR_WALLCLOCK_SYS_H
|
||||||
|
#define TOR_WALLCLOCK_SYS_H
|
||||||
|
|
||||||
|
extern const struct subsys_fns_t sys_wallclock;
|
||||||
|
|
||||||
|
#endif /* !defined(TOR_WALLCLOCK_SYS_H) */
|
Loading…
Reference in New Issue
Block a user