question

Filip-2434 avatar image
0 Votes"
Filip-2434 asked JeanineZhang-MSFT answered

C++ I change system time, what it effect?

Hello everybody.
I chagne with c++ system time. Can it something effect in my computer?
Thanks for answare.


This code i used:

include <windows.h>

include <stdio.h>


void main()
{
SYSTEMTIME st, lt;

 GetSystemTime(&st);
 st.wHour++;
 SetSystemTime(&st);

}


c++
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.

1 Answer

JeanineZhang-MSFT avatar image
0 Votes"
JeanineZhang-MSFT answered

Hi,

For more details about the effect in your computer, I suggest you could refer to the Doc: Change the system time - security policy setting

And you need you need certain privileges in Windows to alter the time, so if you do not have those privileges, then you need to get the Administrator to give you more rights. For example, when you try to use SetSystemTime function, you should have the SE_SYSTEMTIME_NAME privilege.

Best Regards,

Jeanine




If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


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.