VirtualBox

Changeset 44847 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 27, 2013 6:47:11 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
83996
Message:

TMR3UtcNow: Get stable offVirtualSync and offVirtualSyncGivenUp values.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR3/TM.cpp

    r44800 r44847  
    26202620VMMR3_INT_DECL(PRTTIMESPEC) TMR3UtcNow(PVM pVM, PRTTIMESPEC pTime)
    26212621{
     2622    /* Get a stable set of VirtualSync parameters before querying UTC. */
     2623    uint64_t offVirtualSync;
     2624    uint64_t offVirtualSyncGivenUp;
     2625    do
     2626    {
     2627        offVirtualSync        = ASMAtomicReadU64(&pVM->tm.s.offVirtualSync);
     2628        offVirtualSyncGivenUp = ASMAtomicReadU64((uint64_t volatile *)&pVM->tm.s.offVirtualSyncGivenUp);
     2629    } while (ASMAtomicReadU64(&pVM->tm.s.offVirtualSync) != offVirtualSync);
     2630
     2631    Assert(offVirtualSync >= offVirtualSyncGivenUp);
     2632    uint64_t const offLag = offVirtualSync - offVirtualSyncGivenUp;
     2633
    26222634    RTTimeNow(pTime);
    2623     RTTimeSpecSubNano(pTime, ASMAtomicReadU64(&pVM->tm.s.offVirtualSync) - ASMAtomicReadU64((uint64_t volatile *)&pVM->tm.s.offVirtualSyncGivenUp));
     2635    RTTimeSpecSubNano(pTime, offLag);
    26242636    RTTimeSpecAddNano(pTime, pVM->tm.s.offUTC);
    26252637    return pTime;
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