[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #6683 [Tor Relay]: Request: add offset to current system time
#6683: Request: add offset to current system time
-------------------------+--------------------------------------------------
Reporter: tmpname0901 | Owner:
Type: enhancement | Status: needs_revision
Priority: normal | Milestone: Tor: unspecified
Component: Tor Relay | Version:
Keywords: | Parent:
Points: | Actualpoints:
-------------------------+--------------------------------------------------
Comment(by rransom):
Replying to [comment:9 rransom]:
> Which is one reason that I told you to use a static global variable
which the configuration-loading code would set. (Another reason is that
it would suck if your function/macro were ever called before Tor had
loaded its configuration (i.e. with `get_options() == NULL`).)
In particular:
* Define the global variable somewhere (in the same file as `tor_time`,
before it, preferably near it):
{{{
static int time_offset = 0;
}}}
* Add a function to set that variable:
{{{
void
tor_set_time_offset(int new_offset)
{
time_offset = new_offset;
/* XXXX Maybe a cached time needs to be updated here. */
}
}}}
* Call `tor_set_time_offset` when Tor's configuration is changed.
* Use `tor_time` '''everywhere''', not just after Tor has loaded its
configuration once. (Tor will use a time offset of 0 until it is set;
after that, Tor will use the same time offset everywhere, not just in code
that you didn't see run (and crash) before Tor loaded its configuration.)
* Make sure you have configured Tor with the --enable-gcc-warnings
option.
* Run âmake check-spacesâ (semi-optional).
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6683#comment:10>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs