C++ set local pc time

Filip 831 Reputation points
2021-04-09T12:43:52.677+00:00

Hello Everybody.
How can i change the local time on my pc?
Is here way how can i change it with "windows.h"
I used this code but somewho is didn't change.
Thanks for answare.

include <windows.h>

include <stdio.h>

void main()
{
SYSTEMTIME st, lt;
GetLocalTime(&lt);
lt.wHour--;
SetLocalTime(&lt);
}

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,527 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Castorix31 81,726 Reputation points
    2021-04-09T12:58:35.41+00:00

    You must enable the SE_SYSTEMTIME_NAME privilege, as said in the doc

    0 comments No comments