fix calculation method for new_epoch#468
fix calculation method for new_epoch#468harada hiroki (hender14) wants to merge 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes the calculation method for new_epoch in the time manager test to improve test determinism. The change replaces a non-deterministic calculation based on the current time with a fixed offset from the default epoch.
- Changed
new_epochcalculation fromtime.time() - 86400 * 30toTMGR_DEFAULT_UNIXTIME_EPOCH_FOR_UTL + 86400 * 30 - Updated the comment to accurately reflect the new calculation method
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Ryo Suzumoto (@meltingrabbit) cc sksat (@sksat) |
|
harada hiroki (@hender14) これだと,デフォルトエポックが, ただ,エポックがそんなに最近なこともない気がするので,大丈夫な気もします. という悩ましい感じですね. |
|
Ryo Suzumoto (@meltingrabbit) 根本の対策にはなっていませんが、コメントで、epoch 時間が現在時刻-30day にならない様記載すると共に、実際に epoch が未来の時刻で設定された場合は assert でエラーとする事で対応できればと思いますが、如何でしょうか。 # NOTE: テスト内でこの値に +30日 などを加算して検証するケースがあるため、
# 現在時刻に対して十分過去(少なくとも30日以上前)の日時である必要がある。
TMGR_DEFAULT_UNIXTIME_EPOCH_FOR_UTL = 1577836800.0# new_epoch が未来になっていないかチェックし、失敗したらメッセージを出す
assert new_epoch < time.time(), "設定された Epoch が未来時刻になっている" |
|
harada hiroki (@hender14) よさそうです! |
|
Ryo Suzumoto (@meltingrabbit) |
Ryo Suzumoto (meltingrabbit)
left a comment
There was a problem hiding this comment.
良さそうです.ありがとうございます!
概要
FSW 側で ti の値がオーバーフローしない様に、new_epoch の値を小さくする
Issue
検証結果
補足
別途、c2a-pytest-gaia 側の epoch 設定を変える API が無いという問題はあり、此方は arkedge/c2a-pytest-gaia#8 にて対応していく