GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing objects.githubusercontent.com — objects.githubusercontent.com from datetime import datetime
Make_It_Fail = True
def _win_set_time(time_tuple):
import win32api
dayOfWeek = datetime(*time_tuple).isocalendar()[2]
t = time_tuple[:2] + (dayOfWeek,) + time_tuple[2:]
win32api.SetSystemTime(*t)
def _linux_set_time(time_tuple):
import subprocess
import shlex
time_string = datetime(*time_tuple).isoformat()
#subprocess.call(shlex.split("timedatectl set-ntp false")) # May be necessary
subprocess.call(shlex.split("date -s '%s'" % time_string), stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
subprocess.call(shlex.split("hwclock -w"))
def change_time(time_tuple):
import sys
if sys.platform.startswith('linux'):
_linux_set_time(time_tuple)
elif sys.platform == 'win32':
_win_set_time(time_tuple)
def change_time_before():
time_tuple = (2024, # Year
5, # Month
18, # Day
23, # Hour
34, # Minute
43, # Second
0 # Millisecond
)
print('Date/Time before queue.get(): 05/18/2024 23:34:43\n')
change_time(time_tuple)
def change_time_after():
time_tuple = (2023, # Year
5, # Month
18, # Day
18, # Hour
34, # Minute
43, # Second
0 # Millisecond
)
print('Date/Time during queue.get(): 05/18/2023 18:34:43\n')
change_time(time_tuple)
def start_queue():
import queue
import time
q = queue.Queue()
print ("Calling queue get with blocking and 10 seconds timeout\n")
ts = time.monotonic()
try:
q.get(True, 10.0)
except queue.Empty:
te = time.monotonic()
td = te - ts
print (f"{td:0.2f} seconds has elapsed and it is not blocked\n")
def test_queue():
import threading
import time
if Make_It_Fail:
change_time_before()
t = threading.Thread(target=start_queue)
t.start()
time.sleep(1.0)
if Make_It_Fail:
change_time_after()
t.join()
test_queue()
|
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |