VirtualBox

Changeset 75559 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Nov 18, 2018 7:46:04 PM (6 years ago)
Author:
vboxsync
Message:

VBoxService: Always set the time on startup on OS/2.

File:
1 edited

Legend:

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

    r70346 r75559  
    127127static uint32_t         g_TimeSyncSetThreshold = 20*60*1000;
    128128/** Whether the next adjustment should just set the time instead of trying to
    129  * adjust it. This is used to implement --timesync-set-start.  */
    130 static bool volatile    g_fTimeSyncSetNext = false;
     129 * adjust it. This is used to implement --timesync-set-start.
     130 * For purposes of setting the kernel timezone, OS/2 always starts with this. */
     131#ifdef RT_OS_OS2
     132static bool volatile    g_fTimeSyncSetOnStart = true;
     133#else
     134static bool volatile    g_fTimeSyncSetOnStart = false;
     135#endif
    131136/** Whether to set the time when the VM was restored. */
    132137static bool             g_fTimeSyncSetOnRestore = true;
     
    209214            rc = VGSvcCheckPropExist(uGuestPropSvcClientID, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-start");
    210215            if (RT_SUCCESS(rc))
    211                 g_fTimeSyncSetNext = true;
     216                g_fTimeSyncSetOnStart = true;
     217        }
     218        if (   RT_SUCCESS(rc)
     219            || rc == VERR_NOT_FOUND)
     220        {
     221            rc = VGSvcCheckPropExist(uGuestPropSvcClientID, "/VirtualBox/GuestAdd/VBoxService/--timesync-no-set-start");
     222            if (RT_SUCCESS(rc))
     223                g_fTimeSyncSetOnStart = false;
    212224        }
    213225        if (   RT_SUCCESS(rc)
     
    286298        rc = VGSvcArgUInt32(argc, argv, "", pi, &g_TimeSyncSetThreshold, 0, 7*24*60*60*1000); /* a week */
    287299    else if (!strcmp(argv[*pi], "--timesync-set-start"))
    288         g_fTimeSyncSetNext = true;
     300        g_fTimeSyncSetOnStart = true;
     301    else if (!strcmp(argv[*pi], "--timesync-no-set-start"))
     302        g_fTimeSyncSetOnStart = false;
    289303    else if (!strcmp(argv[*pi], "--timesync-set-on-restore"))
    290304        g_fTimeSyncSetOnRestore = true;
     
    630644                bool fSetTimeInThisLoop = false;
    631645                uint64_t AbsDriftMilli = RTTimeSpecGetMilli(&AbsDrift);
    632                 if (AbsDriftMilli > MinAdjust)
     646                if (   AbsDriftMilli > MinAdjust
     647                    || g_fTimeSyncSetOnStart)
    633648                {
    634649                    /*
     
    639654                     */
    640655                    if (   AbsDriftMilli > TimeSyncSetThreshold
    641                         || g_fTimeSyncSetNext
     656                        || g_fTimeSyncSetOnStart
    642657                        || !vgsvcTimeSyncAdjust(&Drift))
    643658                    {
     
    678693
    679694        /* Clear the set-next/set-start flag. */
    680         g_fTimeSyncSetNext = false;
     695        g_fTimeSyncSetOnStart = false;
    681696
    682697        /*
     
    755770    "              [--timesync-interval <ms>] [--timesync-min-adjust <ms>]\n"
    756771    "              [--timesync-latency-factor <x>] [--timesync-max-latency <ms>]\n"
    757     "              [--timesync-set-threshold <ms>] [--timesync-set-start]\n"
     772    "              [--timesync-set-threshold <ms>]\n"
     773    "              [--timesync-set-start|--timesync-no-set-start]\n"
    758774    "              [--timesync-set-on-restore|--timesync-no-set-on-restore]\n"
    759775    "              [--timesync-verbosity <level>]"
     
    775791    "                            where to start setting the time instead of trying to\n"
    776792    "                            adjust it. The default is 20 min.\n"
    777     "    --timesync-set-start    Set the time when starting the time sync service.\n"
     793    "    --timesync-set-start, --timesync-no-set-start    \n"
     794    "                            Set the time when starting the time sync service.\n"
     795#ifdef RT_OS_OS2
     796    "                            Default: --timesync-set-start\n"
     797#else
     798    "                            Default: --timesync-no-set-start\n"
     799#endif
    778800    "    --timesync-set-on-restore, --timesync-no-set-on-restore\n"
    779801    "                            Whether to immediately set the time when the VM is\n"
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