Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a constant for ripple epoch offset #4563

Closed
gregtatcam opened this issue Jun 8, 2023 · 2 comments · Fixed by #4775
Closed

Add a constant for ripple epoch offset #4563

gregtatcam opened this issue Jun 8, 2023 · 2 comments · Fixed by #4775

Comments

@gregtatcam
Copy link
Collaborator

gregtatcam commented Jun 8, 2023

Issue Description

The epoch offset is currently hard-coded in multiple files as seconds(946684800) in (core/Pg.cpp, basics/chrono.h, rpc/handlers/AMMInfo.cpp) and as days(10957) (core/impl/TimeKeeper.cpp, test/jtx/impl/ManualTimeKeeper.cpp).

Epoch offset: 2000-01-01 00:00:00 UTC is 946684800s from 1970-01-01 00:00:00 UTC

Expected Result

Define a constant

@HowardHinnant
Copy link
Contributor

Here's one verbose but readable way to write this constant:

#include <date/date.h>
// ...
std::chrono::seconds constexpr offset = date::sys_days{year{2000}/1/1} - date::sys_days{year{1970}/1/1};

@Bronek
Copy link
Collaborator

Bronek commented Oct 24, 2023

I have this in #4775

EDIT: added to basics/chrono.h

@intelliot intelliot linked a pull request Oct 27, 2023 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants