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

BD-4612 resolve epoch seconds formatting errors #332

Draft
wants to merge 13 commits into
base: develop
Choose a base branch
from
8 changes: 0 additions & 8 deletions contracts/fio.address/fio.address.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -928,14 +928,6 @@ namespace fioio {
//FIP-39 end










[[eosio::action]]
void
regaddress(const string &fio_address, const string &owner_fio_public_key, const int64_t &max_fee,
Expand Down
25 changes: 14 additions & 11 deletions contracts/fio.common/fiotime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ namespace fioio {
std::string tmstringformat(struct tm timeinfo) {
std::string timebuffer = to_string(timeinfo.tm_year);
timebuffer.append("-");
if (timeinfo.tm_mon < 10) {
if (timeinfo.tm_mon+1 < 10) {
timebuffer.append("0");
}
timebuffer.append(to_string(timeinfo.tm_mon));
//tm_mon is 0 based
timebuffer.append(to_string(timeinfo.tm_mon+1));
timebuffer.append("-");
if (timeinfo.tm_mday < 10) {
timebuffer.append("0");
Expand All @@ -51,7 +52,11 @@ namespace fioio {
return timebuffer;
}

int convertfiotime(long long t, struct tm *tm) {




int convertfiotime(long long t, struct tm *tm) {
long long days, secs;
int remdays, remsecs, remyears;
int qc_cycles, c_cycles, q_cycles;
Expand Down Expand Up @@ -106,15 +111,13 @@ namespace fioio {
return -1;

tm->tm_year = years + 2000;
tm->tm_mon = months + 3;
if (tm->tm_mon >= 12) {
tm->tm_mon -= 12;
//tm->tm_year++;

if(tm->tm_mon == 00){ // some unknown but that makes the 12th month 00.
tm->tm_mon = 12;
}
//ajust month for using march 1 2000 as our leapoch
int tmonth = months+2;
if (tmonth > 11){
tm->tm_year = years + 2000 + 1;
}

tm->tm_mon = tmonth % 12;
tm->tm_mday = remdays + 1;
tm->tm_wday = wday;
tm->tm_yday = yday;
Expand Down