В общем разобрался со своей проблемой, оказалось, что мне нужно было менять локальное время, а не системное. Сделал, вот так:
class SYSTEMTIME(ctypes.Structure):
_fields_ = [
('wYear', ctypes.c_int16),
('wMonth', ctypes.c_int16),
('wDayOfWeek', ctypes.c_int16),
('wDay', ctypes.c_int16),
('wHour', ctypes.c_int16),
('wMinute', ctypes.c_int16),
('wSecond', ctypes.c_int16),
('wMilliseconds', ctypes.c_int16)]
def set_date(day, month, year):
CurrentTime = SYSTEMTIME()
lpSystemTime = ctypes.pointer(CurrentTime)
ctypes.windll.kernel32.GetLocalTime(lpSystemTime)
for attr, value in {'wDay': day, 'wMonth': month, 'wYear': year}.items():
setattr(CurrentTime, attr, value)
ctypes.windll.kernel32.SetLocalTime(CurrentTime)
def get_date():
CurrentTime = SYSTEMTIME()
lpSystemTime = ctypes.pointer(CurrentTime)
ctypes.windll.kernel32.GetLocalTime(lpSystemTime)
return CurrentTime.wDay, CurrentTime.wMonth, CurrentTime.wYear