Peers can cause incorrect warning about time and date #2990

issue kuzetsa opened this issue on September 13, 2013
  1. kuzetsa commented at 1:58 PM on September 13, 2013: none

    bitcoin-0 8 5_nagbug

    Time is set correctly. System time is accurate to within 250ms of several stratum 2 / stratum 3 NTP servers.

    (Local NY timezone selected under windows control panel, hardware clock is NOT set to UTC because that's not how NT 6.1, 6.0, 5.1, 5.0, 4.0 or any version of windows handles such things)

    This bug probably also affects other versions of windows as well.

    Edit @laanwj: renamed to make clear this is not a problem with timezone detection or windows

  2. kuzetsa commented at 2:05 PM on September 13, 2013: none

    http://support.microsoft.com/kb/2800213

    Workaround registry setting to force UTC hardware clock caused at least one bug as recently as Feb 2013 ... this sort of thing really isn't supported by microsoft.

  3. kuzetsa commented at 2:46 PM on September 13, 2013: none

    https://github.com/bitcoin/bitcoin/commit/8686f6467c9db2606706baca33842c97ff7621f8

    Current version as found in 0.8.5 assumes:

    static int64 nTimeOffset = 0;
    

    followed immediately by dummy function which returns that hardcoded value:

    int64 GetTimeOffset()
    {
        return nTimeOffset;
    }
    

    Some poorly (not at all) commented code follows a "humorous" comment:

    //
    // "Never go to sea with two chronometers; take one or three."
    // Our three time sources are:
    //  - System clock
    //  - Median of other nodes clocks
    //  - The user (asking the user to fix the system clock if the first two disagree)
    //
    

    All of this code was in util.cpp, and I couldn't make sense of the purpose of large portions of how or why "zero" was hardcoded in so many places (mainly from the lack of comments)

  4. gavinandresen commented at 10:22 PM on September 13, 2013: contributor

    nTimeOffset is not a hardcoded value, it is adjusted based on the time reported by your network peers.

    And I don't think this is a Windows issue-- I saw the same thing happen on my OSX machine yesterday when I first connected, most likely caused by connecting to peers that either have their time set incorrectly accidentally (did daylight savings time start or stop somewhere recently?) or on purpose.

  5. gmaxwell commented at 11:45 PM on September 13, 2013: contributor

    See my comments on #bitcoin-dev around 11:43 pacific.

  6. kuzetsa commented at 5:08 PM on December 9, 2013: none

    Did someone rename this issue? I was coming back to try and review the status, but found that the title no longer mentioned windows... what happened? Did I just remember wrong?

  7. laanwj commented at 5:18 PM on December 9, 2013: member

    As this is not a windows specific issue, I edited the title and also added a message to the opening post.

  8. kuzetsa commented at 3:38 PM on July 14, 2014: none

    Acking the discussion on freenode in #bitcoin-dev, ongoing at this time.<br>(at or around 11:37 Local NY time, 2014 July 14)

  9. MarcoFalke commented at 4:42 PM on December 30, 2016: member

    Is this even a bug on our side? The only thing I see that can be done is to change the warning message http://bitcoinstats.com/irc/bitcoin-dev/logs/2014/07/14#l1405352477.0

  10. kuzetsa commented at 6:30 AM on January 13, 2017: none

    I don't actually know if this is an ongoing issue, since I haven't used bitcoin in a long time (been something like 2 years now)

    If someone has additional information about the issue or knows if there was a change made to the behavior, feel free to update or close #2990 as appropriate. I don't have any relevant/recent knowledge, regardless of what happens here.

  11. laanwj removed the label Priority Medium on Apr 25, 2017
  12. laanwj closed this on Mar 6, 2018

  13. Bushstar referenced this in commit 23fc663f5c on Apr 8, 2020
  14. MarcoFalke 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-29 03:16 UTC

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