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

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:add_startuptime_to_log changing 4 files +5 −4
  1. Diapolo commented at 9:11 PM on May 21, 2012: none
    • 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.

  2. TheBlueMatt commented at 11:45 AM on May 22, 2012: member

    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.

  3. Diapolo commented at 12:43 PM on May 22, 2012: none

    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.

  4. TheBlueMatt commented at 1:11 PM on May 22, 2012: member

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

  5. Diapolo commented at 1:27 PM on May 22, 2012: none

    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.

  6. sipa commented at 9:04 PM on May 22, 2012: member

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

  7. TheBlueMatt commented at 9:06 PM on May 22, 2012: member

    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().

  8. Diapolo commented at 9:33 PM on May 22, 2012: none

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

  9. add client startup time as an entry to debug.log (note: logged time in debug.log differs by a few seconds from the one displayed in the Debug window) / make ClientModel::formatClientStartupTime() return a QString 41c6b8abc6
  10. in src/qt/clientmodel.cpp:None in fbda12ebc3 outdated
     128 | @@ -130,9 +129,9 @@ QString ClientModel::clientName() const
     129 |      return QString::fromStdString(CLIENT_NAME);
     130 |  }
     131 |  
     132 | -QDateTime ClientModel::formatClientStartupTime() const
     133 | +QString ClientModel::formatGetTime() const
    


    laanwj commented at 3:59 PM on May 23, 2012:

    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.


    Diapolo commented at 4:16 PM on May 23, 2012:

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


    laanwj commented at 4:16 PM on May 23, 2012:

    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?


    Diapolo commented at 4:20 PM on May 23, 2012:

    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()?


    laanwj commented at 4:24 PM on May 23, 2012:

    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.


    Diapolo commented at 4:46 PM on May 23, 2012:

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


    laanwj commented at 4:57 PM on May 23, 2012:

    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.

  11. Diapolo commented at 5:10 PM on May 23, 2012: none

    Alright, updated and final now.

  12. laanwj commented at 4:53 AM on May 24, 2012: member

    ACK

  13. luke-jr commented at 2:59 AM on May 26, 2012: member

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

  14. Diapolo commented at 8:52 AM on May 26, 2012: none

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

  15. sipa referenced this in commit 1e07068adf on May 26, 2012
  16. sipa merged this on May 26, 2012
  17. sipa closed this on May 26, 2012

  18. luke-jr commented at 12:35 PM on May 26, 2012: member

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

  19. coblee referenced this in commit 7754fbe2f3 on Jul 17, 2012
  20. suprnurd referenced this in commit 8c64c0a7cf on Dec 5, 2017
  21. lateminer referenced this in commit e8e62f450d on Jan 22, 2019
  22. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me