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

Filip 831 Reputation points
2021-04-09T12:30:29.257+00:00

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++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,856 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jeanine Zhang-MSFT 10,536 Reputation points Microsoft Vendor
    2021-04-12T02:04:47.037+00:00

    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.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.