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 client startup time as an entry to debug.log #1370

Merged
merged 1 commit into from
May 26, 2012
Merged

add client startup time as an entry to debug.log #1370

merged 1 commit into from
May 26, 2012

Conversation

Diapolo
Copy link

@Diapolo Diapolo commented May 21, 2012

  • make ClientModel::formatClientStartupTime() return a QString

Note: Logged time in debug.log differs by a few seconds from the one displayed in the Debug window because of different initialisation times.

@TheBlueMatt
Copy link
Contributor

I dont see any reason to make nClientStartupTime yet another global, throwing in one more call to GetTime() seems cleaner to me, but maybe I just hate globals.

@Diapolo
Copy link
Author

Diapolo commented May 22, 2012

The global is used by the GUI Debug window and IS present in the current code. It only moved from clientmodel.cpp to util.cpp, to allow usage in the debug.log entry.

@TheBlueMatt
Copy link
Contributor

Putting something in util.h is very different from qt/clientmodel.cpp, but Im probably just overly global-hating.

@Diapolo
Copy link
Author

Diapolo commented May 22, 2012

Luke-Jr encouraged me to use a global ... seems like it's hard sometimes to get to the best approach. If no one thinks this is beneficial, just close the pull.

@sipa
Copy link
Member

sipa commented May 22, 2012

I don't see why you need a global for this? You only use it once...

@TheBlueMatt
Copy link
Contributor

I think its beneficial, and have no problem with it in general, my point was simply to remove the global definitions, and replace the single use in init.cpp with a call to GetTime().

@Diapolo
Copy link
Author

Diapolo commented May 22, 2012

I checked the GUI code and yes, I can safely remove the whole global ;). Will update tomorrow!

@@ -130,9 +129,9 @@ QString ClientModel::clientName() const
return QString::fromStdString(CLIENT_NAME);
}

QDateTime ClientModel::formatClientStartupTime() const
QString ClientModel::formatGetTime() const
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't Qt have it's own format time function? There's no need to put this in clientmodel as this requests nothing from the client.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When removing the constant, I did not consider to remove this, will update.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I get it. I guess you want to store the time when the ClientModel is created. Better to add a QDateTime field to the structure, fill it in the constructor, then return that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it's even sufficient to add the time once in the RPCConsole constructor, via ui->startupTime->setText(QDateTime::fromTime_t(GetTime()).toString());, or should that stay in RPCConsole::setClientModel()?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it should stay in ClientModel. Don't put such state in views, better not to rely on it that RPCConsole is created once at the beginning of the program and kept around forever. This may change later.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now only changed the code in ClientModel to return a QString, to not rely on RPCConsole object persistence.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's fine... though officially it'd be better to return a datetime as that leaves formatting to the view instead of the model... in this case this is the same as we do for the other datetimes. It's only a minor thing anyway.

…n debug.log differs by a few seconds from the one displayed in the Debug window) / make ClientModel::formatClientStartupTime() return a QString
@Diapolo
Copy link
Author

Diapolo commented May 23, 2012

Alright, updated and final now.

@laanwj
Copy link
Member

laanwj commented May 24, 2012

ACK

@luke-jr
Copy link
Member

luke-jr commented May 26, 2012

Yeah, while a global makes sense for what you were doing before, this one-time use doesn't need it ;)

@Diapolo
Copy link
Author

Diapolo commented May 26, 2012

@luke-jr :-D Was that an ACK then ;)?

sipa added a commit that referenced this pull request May 26, 2012
add client startup time as an entry to debug.log
@sipa sipa merged commit 1e07068 into bitcoin:master May 26, 2012
@luke-jr
Copy link
Member

luke-jr commented May 26, 2012

Looks good, but I only ACK stuff after I have actually tested it myself. ;)

coblee pushed a commit to litecoin-project/litecoin that referenced this pull request Jul 17, 2012
add client startup time as an entry to debug.log
suprnurd pushed a commit to chaincoin-legacy/chaincoin that referenced this pull request Dec 5, 2017
lateminer pushed a commit to lateminer/bitcoin that referenced this pull request Jan 22, 2019
* Use reference in range based loop

* Test for TxAlreadyHave() before deciding whether to process

What we were doing before was causing us to fall through and end
up removing all the coins that were just put in cache if we processed
a transation that was already in the commiQ or mempool. Futhermore we
were marking it as a recentReject incorrectly.
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants