Changeset 26113 in vbox
- Timestamp:
- Feb 1, 2010 11:04:57 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxService/VBoxServiceTimeSync.cpp
r26074 r26113 434 434 * 435 435 * @param pDrift The time adjustment. 436 * @param pHostNow The host time at the time of the host query. 437 * REMOVE THIS ARGUMENT! 438 */ 439 static void VBoxServiceTimeSyncSet(PCRTTIMESPEC pDrift, PCRTTIMESPEC pHostNow) 436 */ 437 static void VBoxServiceTimeSyncSet(PCRTTIMESPEC pDrift) 440 438 { 441 439 /* … … 443 441 */ 444 442 #ifdef RT_OS_WINDOWS 445 /** @todo r=bird: Get current time and add the adjustment, the host time is 446 * stale by now. */ 447 FILETIME ft; 448 RTTimeSpecGetNtFileTime(pHostNow, &ft); 449 SYSTEMTIME st; 450 if (FileTimeToSystemTime(&ft, &st)) 451 { 452 if (!SetSystemTime(&st)) 453 VBoxServiceError("SetSystemTime failed, error=%u\n", GetLastError()); 443 RTTIMESPEC hostNow; 444 int rc = VbglR3GetHostTime(&hostNow); 445 if (RT_FAILURE(rc)) 446 { 447 if (g_cTimeSyncErrors++ < 10) 448 VBoxServiceError("VbglR3GetHostTime failed; rc=%Rrc\n", rc); 454 449 } 455 450 else 456 VBoxServiceError("Cannot convert system times, error=%u\n", GetLastError()); 457 451 { 452 FILETIME ft; 453 RTTimeSpecGetNtFileTime(&hostNow, &ft); 454 SYSTEMTIME st; 455 if (FileTimeToSystemTime(&ft, &st)) 456 { 457 if (!SetSystemTime(&st)) 458 VBoxServiceError("SetSystemTime failed, error=%u\n", GetLastError()); 459 } 460 else 461 VBoxServiceError("Cannot convert system times, error=%u\n", GetLastError()); 462 } 458 463 #else /* !RT_OS_WINDOWS */ 459 464 struct timeval tv; … … 564 569 { 565 570 VBoxServiceTimeSyncCancelAdjust(); 566 VBoxServiceTimeSyncSet(&Drift , &HostNow);571 VBoxServiceTimeSyncSet(&Drift); 567 572 } 568 573 }
Note:
See TracChangeset
for help on using the changeset viewer.