Would it be possible to freeze the Windows clock with Python?
If yes, what library does this?
Would it be possible to freeze the Windows clock with Python?
If yes, what library does this?
I may not have understood what you want, but from what I understand, it is not possible. No programming language with any library has the ability to make such a profound change in the operating system. You can only change something in it if it allows, this is one of the reasons for an operating system.
I can not imagine a practical utility for this but it is possible to get a result close to it by successively changing the computer time. This is what Windows allows. You could create a loop (which would not allow the application to do other tasks, though you have how to allow this) to repeat the change:
import datetime
import time
time_tuple = time.localtime(time.time())
while True:
win_set_time(time_tuple)
time.sleep(1) # espera 1 segundo
def win_set_time(time_tuple):
import pywin32
dayOfWeek = datetime.datetime(time_tuple).isocalendar()[2]
pywin32.SetSystemTime(time_tuple[:2] + (dayOfWeek,) + time_tuple[2:])
Code removed from this answer in SO .