VirtualBox

Changeset 69994 in vbox


Ignore:
Timestamp:
Dec 7, 2017 5:08:49 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
119501
Message:

VBoxServiceTimeSync.cpp: Log radical changes to the guest time too, even the ones we cause (for now).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp

    r69993 r69994  
    537537
    538538    /*
    539      * Initialize the last host time to prevent log message.
     539     * Initialize the last host and guest times to prevent log message.
     540     * We also tracks whether we set the time in the previous loop.
    540541     */
    541542    RTTIMESPEC HostLast;
    542543    if (RT_FAILURE(VbglR3GetHostTime(&HostLast)))
    543544        RTTimeSpecSetNano(&HostLast, 0);
     545    RTTIMESPEC GuestLast;
     546    RTTimeNow(&GuestLast);
     547    bool fSetTimeLastLoop = false;
    544548
    545549    /*
     
    617621                }
    618622
     623                bool fSetTimeInThisLoop = false;
    619624                uint32_t AbsDriftMilli = RTTimeSpecGetMilli(&AbsDrift);
    620625                if (AbsDriftMilli > MinAdjust)
     
    632637                        vgsvcTimeSyncCancelAdjust();
    633638                        vgsvcTimeSyncSet(&Drift);
     639                        fSetTimeInThisLoop = true;
    634640                    }
    635641
     
    645651                    vgsvcTimeSyncCancelAdjust();
    646652                HostLast = HostNow;
     653
     654                /*
     655                 * Log radical guest time changes (we could be the cause of these, mind).
     656                 * Note! Right now we don't care about an extra log line after we called
     657                 *       vgsvcTimeSyncSet.  fSetTimeLastLoop helps show it though.
     658                 */
     659                int64_t cNsGuestDelta = RTTimeSpecGetNano(&GuestNow) - RTTimeSpecGetNano(&GuestLast);
     660                if ((uint64_t)RT_ABS(cNsGuestDelta) > RT_NS_1HOUR / 2)
     661                    vgsvcTimeSyncLog(0, "vgsvcTimeSyncWorker: Radical guest time change: %'RI64ns (GuestNow=%RDtimespec GuestLast=%RDtimespec fSetTimeLastLoop=%RTbool)\n",
     662                                     cNsGuestDelta, &GuestNow, &GuestLast, fSetTimeLastLoop);
     663                GuestLast = GuestNow;
     664                fSetTimeLastLoop = fSetTimeInThisLoop;
    647665                break;
    648666            }
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette