How the Meinberg Time Adjustment Service Works
The Meinberg Time Adjustment Service (mbgadjtm.exe
) is supplied as part of the
Meinberg driver package for Windows
to synchronize the Windows system time with the time of a Meinberg PCI card,
a Meinberg USB clock or an external Meinberg clock.
When the service is activated, it runs in the background, performs periodic time comparisons and
corrects the Windows system time if necessary.
The included monitor program (mbgmon.exe
) can be used to configure the time adjustment service
and the installed clock device, if necessary, and to check the status. In most cases, the default configuration
should be adequate for reliable operation, so changes to the service configuration should not be necessary.
After installing the driver program, the time adjustment service must be activated once only after the correct time of the radio-controlled clock has been checked.
Basic operation
The time service will not start adjusting the system time until the installed clock device has synchronized with its time source at least once after power up.
This is to prevent the system time from being set incorrectly if, for example, the system has been switched off for a long time and the time of the clock device is therefore no longer accurate immediately after switching on.
Together with its current on-board time, the clock device outputs a status indicating, for example, whether the time on the device is synchronized or not. After the clock has synchronized with its time source at least once, the time service will use the time of the clock device, even if the radio-controlled clock has temporary reception problems and runs on a quartz basis.
Windows System Time is UTC
The Windows system time is internally based on UTC (Coordinated Universal Time, formerly also known as GMT
),
and most time synchronization programs work in such a way that an external reference time is always calculated back
to UTC first: with a DCF77 radio clock, 2 hours for daylight saving time are subtracted to obtain UTC, and only
1 hour for standard time. The resulting UTC time is then compared to the computer's UTC system time, and the
computer's UTC system time is adjusted if necessary to keep the time difference as small as possible.
Programs that work in this way include the Meinberg time service, the
NTP service for Windows (ntpd.exe),
NTP service for Windows (ntpd.exe
),
and the “Windows Time” service (w32time.exe
) that ships with Windows.
Local Time and Daylight Saving Time
Due to the mode of operation described above, the daylight saving time (DST) status of a clock device does not affect the local time displayed in Windows, nor does the clock device determine if and when a daylight saving time changeover takes place in Windows.
Instead, the rules for calculating the current local time from the current system time are stored in the Windows registry for each time zone that can be selected in Windows. If the DST rules change due to political decisions, these rules in the registry need to be updated accordingly, which is usually done through Windows updates provided by Microsoft.
From a time synchronization point of view, there is therefore no time jump at the beginning or end of DST because the Windows system time does not change. Instead, only the calculation of the local time from the system time is adjusted and the local time is displayed accordingly.
Windows provides all programs with different functions that return either the current UTC system time or the current local time, depending on the selected time zone setting.
When reading the current Windows local time, it is calculated from the system time for each query:
- Read the current UTC system time
- Add the standard time offset of the time zone (e.g. 1 hour for CET)
- Test if the time is after the start and before the end of DST
- If so, add the daylight saving time offset (e.g. 1 hour for CEST)
- Return the result to the calling program and, depending on the API function, convert it to a human-readable date and time in hours, minutes, and seconds.
This means that if the underlying Windows system time is correct and the time zone settings stored in the registry are correct, the local time displayed in Windows will always change at exactly the right time.
See also the Meinberg whitepapers at
Especially chapters 4.4, 4.6 and 4.7 in
- “Computer Time Synchronization Concepts”
https://www.meinberg.de/download/burnicki/Computer%20Time%20Synchronization%20Concepts%20-%202014-04-29.pdf
The monitor program mbgmon.exe
displays the current settings of the selected Windows time zone in the
tab “Windows time zone”. This feature was added to the monitor program because in older versions of Windows,
there was no way to view the details of the selected setting and check the current switch times for the
start and end of Daylight Saving Time.
Setting the System Time or "Smooth" Adjustment of the Time
If the time service is active, the “PC System Time”, the “Reference Time” (radio clock time) and the calculated “Time Difference” are displayed in the “Time Adjustment” tab of the monitor program. These values are updated after each time comparison. Although the time comparison takes place approximately every second, it does not normally take place at the exact second change, but at some point in the middle of the second. The times are therefore displayed with a resolution of 100ths of a second, and the “Time Difference” may be displayed with an even higher resolution.
If the difference between the Windows system time and the reference time read from the clock device is less than the so-called “Sync radius” (default 1 s, see “Time service” tab in the monitor program), the system time is adjusted ‘smoothly’ by slight acceleration or deceleration, so that other applications usually do not even notice these corrections and a larger time deviation does not even emerge in continuous operation.
Reasons for a Large Time Difference
Besides faulty system configurations, where, for example, other programs are changing the Windows system time, there are actually only two ways a larger time difference can occur:
1.) Immediately after a computer restart, there is a time difference between the radio clock time and the computer's system time. The radio clock is not yet synchronized, and therefore, it is not known whether the radio clock or the system time is “more accurate.” The time service waits until the radio clock is synchronized and thus has the exact time, and only then begins synchronizing the system time.
2.) The radio clock was already synchronized once, so the time service adjusts the system time to the radio clock time, even if it subsequently loses reception and goes into freewheel mode. While the radio clock is in freewheel mode, its time usually drifts, and if the clock remains in freewheel mode for a very long time, the time can drift significantly. If the radio clock suddenly becomes synchronized again, its time jumps back to the exact value, and there is suddenly a time difference between the radio clock time and the system time, which had been “drifting along” with it.
In both cases, the time service “sees” a time difference that must be compensated by correcting the system time.
Time Jump When the Sync Radius is Exceeded
If the time difference to be corrected is greater than the “Sync. Radius”, the system time is not adjusted smoothly, but is set once. For example, if the deviation is 7 minutes, the system time is stepped by 7 minutes. As a result, other programs that are activated at minute changes may miss the skipped minute changes.
This can be avoide by setting the “Sync. Radius” accordingly high. This will ensure that the system time is smoothly adjusted even in the case of larger deviations, which can, of course, take quite a long time.
Note: In the monitor program of older driver versions, only values up to 99 s can be configured. This is a limitation of the monitor program. If the monitor program is updated, values up to 99999 s can be entered.
In driver versions dkwin-3.08
and newer, it is possible to completely disable
hard setting of the time by setting the “Sync. Radius” to 0 s. However, this should
not be done with earlier driver versions, as the time service from those versions does not
support it, and a “Sync. Radius” of 0 s would cause the system time to be hard set
every few seconds, since the time deviation is always slightly greater or less
than 0, but never exactly 0.
The current driver version is available for download from the Meinberg web server:
If Something Doesn't Work as Expected
If time synchronization is not working as expected, the following information may help determine the reason.