[tor-bugs] #6683 [Tor Relay]: Request: add offset to current system time

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Sun Aug 26 19:02:47 UTC 2012


#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:                  
-------------------------+--------------------------------------------------
Changes (by rransom):

  * status:  new => needs_revision


Comment:

 Replying to [comment:4 tmpname0901]:

 > In the meantime, attached is the patch to implement my requested
 enhancement.  This patch is against Tor v0.2.3.20.rc and has been running
 ( fingerprint: 24EB8A109D4C2555B2D61BB6C70041B5C4702066 ) for about 36
 hours now.  I'm running with new config option TimeOffset option set to
 -7356 to compensate for my 2:02:36 system time inaccuracy.
 >
 > The heavy lifting is done in file or.h with this line:
 >
 >     #define CURRTIME (time(NULL) + get_options()->TimeOffset)

 Eeek!  That's a scary way to do it.

 Better to implement a `tor_time` function in `src/common/util.[hc]` which
 adds an offset stored in a global static variable, then set that variable
 when the options are loaded.  You might also need to change other time-
 related functions in there, too.

 (This will also let you use your adjusted time in code in src/common/, not
 just in src/or/ .)

-- 
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/6683#comment:5>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list