4

Just curious if there's some calculation that happens or what exactly because when I ran it on my machine it froze for a solid minute before giving me the difficulty....froze the whole machine nothing would respond. One thing to note is that monerod hadn't been running for but maybe 15 seconds before I ran ./monderod diff.

**Edit - I've since found that the freezing I experienced was due to my graphics driver.

1 Answer 1

5

I may be wrong but I assume this is the code initialized when you run "diff" in monerod.


  uint64_t now = time(NULL);

  uint64_t diff = ts > now ? ts - now : now - ts;

  if (diff > 24*3600)

    strftime(buffer, sizeof(buffer), "%Y-%m-%d", &tm);

  else

    strftime(buffer, sizeof(buffer), "%I:%M:%S %p", &tm);

  return std::string(buffer);
}
6
  • Thanks for the answer, I really need a secret decoder ring (or ya know, to learn to code and dig into it)!
    – gdoober
    Commented Oct 17, 2016 at 12:56
  • I think I've got the source I just need to dig in and try to figure out what I'm looking at. I'm also curious because it says 'creating logger system' when I run it. Seems an odd thing to do/say when just getting current difficulty.
    – gdoober
    Commented Oct 17, 2016 at 12:58
  • is there anything in that code that would slow down an i7 processor with 16 gb of ram? with nothing else that should take up much resources at all.
    – gdoober
    Commented Oct 17, 2016 at 14:50
  • 2
    Well im running a low end i7 with 8gb of ram on linux on a virtual machine using only 3 cores, and when i run it, it runs almost instantly... I would imagine it will be another reason as to why your machine froze, and it was just coincidental that you was running that specific function at the time, because to me, the function is in no way resource heavy, especially to freeze out a machine with your specific specs!
    – Lurker
    Commented Oct 17, 2016 at 15:01
  • 1
    To be honest, looking at it again, im skeptical as to whether this is the only code that runs when the "diff" is called. No doubt someone with more coding experience than myself (little to non) should be able to find the correct functions called through "diff" on GitHub faster than myself.
    – Lurker
    Commented Oct 17, 2016 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.