question

PSHUN99-0541 avatar image
0 Votes"
PSHUN99-0541 asked PSHUN99-0541 commented

C++ Checking if internet time is ON

Hi!
I'm writing a program, and some parts of it can work correctly only if the Internet Time is enabled in the Win10 settings.
How can I check through C++ code if it's turned On?

The program runs in other people's PCs, so the goal is to be able to do this without any additional settings, or system variables (for example in the Registry Editor).

This is the setting's place in the Control Panel:
137087-image.png


windows-10-generalc++
image.png (59.9 KiB)
· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Is your goal to actually check that settings is on, or that the time is correct (for some reason)?

0 Votes 0 ·
PSHUN99-0541 avatar image PSHUN99-0541 DavidLowndes-6766 ·

The final goal is to make sure, that the User has a correct time, and the settings are not manipulated.

0 Votes 0 ·

For a standalone system changing the system time and these Control Panel settings (and the registry key mentioned below by @Castorix31 requires Administrator privileges. So, for a standard user it seems to me that this is a non-issue.

0 Votes 0 ·
Show more comments

1 Answer

Castorix31 avatar image
1 Vote"
Castorix31 answered PSHUN99-0541 commented

It is stored in the registry, at :

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\W32Time\Parameters\Type

(NTP if configured)

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks, I will dive into this!

0 Votes 0 ·

Thanks, I was able to achive what I wanted based on this!

0 Votes 0 ·