VirtualBox

Changeset 16954 in vbox


Ignore:
Timestamp:
Feb 19, 2009 4:55:55 PM (16 years ago)
Author:
vboxsync
Message:

VBoxGuest, VBoxService: First stuff for new R3 time synchronization with the host.

Location:
trunk/src/VBox/Additions
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuest.cpp

    r15811 r16954  
    13631363
    13641364/**
    1365  * Worker thread to do periodic things such as synchronize the
    1366  * system time and notify other drivers of events.
     1365 * Worker thread to do periodic things such as notify other
     1366 * drivers of events.
    13671367 *
    13681368 * @param   pDevExt device extension pointer
     
    13751375    dprintf(("VBoxGuest::vboxWorkerThread entered\n"));
    13761376
    1377     VMMDevReqHostTime *req = NULL;
    1378 
    1379     int rc = VbglGRAlloc ((VMMDevRequestHeader **)&req, sizeof (VMMDevReqHostTime), VMMDevReq_GetHostTime);
    1380 
    1381     if (RT_FAILURE(rc))
    1382     {
    1383         dprintf(("VBoxGuest::vboxWorkerThread: could not allocate request buffer, exiting rc = %d!\n", rc));
    1384         return;
    1385     }
    1386 
    13871377    /* perform the hypervisor address space reservation */
    13881378    reserveHypervisorMemory(pDevExt);
     
    13901380    do
    13911381    {
    1392         /*
    1393          * Do the time sync
    1394          */
    1395         {
    1396             LARGE_INTEGER systemTime;
    1397             #define TICKSPERSEC  10000000
    1398             #define TICKSPERMSEC 10000
    1399             #define SECSPERDAY   86400
    1400             #define SECS_1601_TO_1970  ((369 * 365 + 89) * (uint64_t)SECSPERDAY)
    1401             #define TICKS_1601_TO_1970 (SECS_1601_TO_1970 * TICKSPERSEC)
    1402 
    1403 
    1404             req->header.rc = VERR_GENERAL_FAILURE;
    1405 
    1406             rc = VbglGRPerform (&req->header);
    1407 
    1408             if (RT_SUCCESS(rc) && RT_SUCCESS(req->header.rc))
    1409             {
    1410                 uint64_t hostTime = req->time;
    1411 
    1412                 // Windows was originally designed in 1601...
    1413                 systemTime.QuadPart = hostTime * (uint64_t)TICKSPERMSEC + (uint64_t)TICKS_1601_TO_1970;
    1414                 dprintf(("VBoxGuest::vboxWorkerThread: synching time with host time (msec/UTC): %llu\n", hostTime));
    1415                 ZwSetSystemTime(&systemTime, NULL);
    1416             }
    1417             else
    1418             {
    1419                 dprintf(("VBoxGuest::PowerStateRequest: error performing request to VMMDev."
    1420                           "rc = %d, VMMDev rc = %Rrc\n", rc, req->header.rc));
    1421             }
    1422         }
     1382        /* Nothing to do here yet. */
    14231383
    14241384        /*
     
    14401400
    14411401    dprintf(("VBoxGuest::vboxWorkerThread: we've been asked to terminate!\n"));
    1442 
    1443     /* free our request buffer */
    1444     VbglGRFree (&req->header);
    14451402
    14461403    if (pDevExt->workerThread)
  • trunk/src/VBox/Additions/WINNT/VBoxService/Makefile.kmk

    r15176 r16954  
    3333        VBoxService.cpp \
    3434        VBoxUtils.cpp \
    35         VBoxService.rc
    36 
     35        VBoxService.rc \
     36        VBoxTimeSync.cpp
    3737ifdef VBOX_WITH_GUEST_PROPS
    3838 VBoxService_SOURCES += \
  • trunk/src/VBox/Additions/WINNT/VBoxService/VBoxService.cpp

    r13837 r16954  
    2424    #include "VBoxVMInfo.h"
    2525#endif
     26#include "VBoxTimeSync.h"
    2627#include "resource.h"
    2728
     
    5354    },
    5455#endif
     56    {
     57        "TimeSync",
     58        vboxTimeSyncInit,
     59        vboxTimeSyncThread,
     60        vboxTimeSyncDestroy,
     61    },
    5562    {
    5663        NULL
  • trunk/src/VBox/Additions/WINNT/VBoxService/VBoxService.h

    r13462 r16954  
    3535#include <iprt/assert.h>
    3636#include <iprt/initterm.h>
     37#include <iprt/log.h>
    3738#include <iprt/string.h>
    38 #include <iprt/log.h>
     39#include <iprt/time.h>
    3940
    4041#include <VBox/version.h>
  • trunk/src/VBox/Additions/common/VBoxGuestLib/Makefile.kmk

    r12446 r16954  
    9898        VBoxGuestR3LibGR.cpp \
    9999        $(if $(VBOX_WITH_GUEST_PROPS),VBoxGuestR3LibGuestProp.cpp,) \
    100         VBoxGuestR3LibMisc.cpp
     100        VBoxGuestR3LibMisc.cpp \
     101        VBoxGuestR3LibTime.cpp
    101102endif
    102103
Note: See TracChangeset for help on using the changeset viewer.

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