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

Wrong get_current_ms_epoch() Returned? #43

Open
CMLDMR opened this issue Sep 18, 2020 · 1 comment
Open

Wrong get_current_ms_epoch() Returned? #43

CMLDMR opened this issue Sep 18, 2020 · 1 comment

Comments

@CMLDMR
Copy link

CMLDMR commented Sep 18, 2020

get_current_ms_epoch() function return stupid unsigned long.

if back to readable format , that show 2055/../..

at here;

void BinaCPP::get_account( long recvWindow, Json::Value &json_result )

@ghost
Copy link

ghost commented Feb 23, 2021

For some reason, the return type of get_current_ms_epoch() is unsigned long, which is way too small to store the value of unix epoch time in miliseconds.

However, I've managed to fix this by ditching get_current_ms_epoch(), and creating a new function that returns the millisecond part of the number and appending the seconds part and milliseconds part to the string separately.

In binapp_utils.cpp I added:

unsigned long get_current_epoch_decimal_place() {
	struct timeval tv;
	gettimeofday(&tv, NULL);
	return tv.tv_usec / 1000;
}

And with querystring.append(to_string(get_current_ms_epoch())) in BinaCPP::get_account, I replaced it with

querystring.append( to_string( get_current_epoch() ) );
querystring.append(to_string(get_current_epoch_decimal_place()));

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

No branches or pull requests

1 participant