On Tue, Jan 10, 2023 at 8:22 AM Nick Mathewson <nickm@torproject.org> wrote:
```
Filename: 342-decouple-hs-interval.md
Title: Decoupling hs_interval and SRV lifetime
Author: Nick Mathewson
Created: 9 January 2023
Status: Draft
```

# Motivation and introduction


I think there's another issue to address here too: the offset from the Unix Epoch at which the first Time Period begins.  According to rend-spec-v3,

"we want our time periods to start at 12:00UTC every day, so
we subtract a "rotation time offset" of 12*60 minutes from the number of
minutes since the epoch, before dividing by the time period (effectively
making "our" epoch start at Jan 1, 1970 12:00UTC)."

But this isn't exactly what the C Tor implementation does.  In `hs_get_time_period_num(),` it defines the offset as `sr_state_get_phase_duration()`, which is tied to the voting interval and the constant SHARED_RANDOM_N_ROUNDS (which is 12).

David, do you have any thoughts on the right solution here?  Some options are:
  * We could document the current behavior.
  * We could add a consensus parameter for the time period offset.
  * We could define the time period offset as exactly 12 hours in all cases. (I guess this would break test networks though?)
  * Something else?

best wishes,
--
Nick