The tock timestamp is _not_ the end of the next bar. It is simply the current time. In 2.40 tock is run by the internal state machine in the backtest, so that tock timestamps are always synchronized to the ticks. In 2.35, tock timestamps were unsynchronized.

Whether to detect month changes in run or in tock depends on what for you're using it. If your script must react immediately on a new month, even in the middle of a bar, then you must check the change of month(0) inside tock or tick. That's easy with a static variable.