def main():
    global MAX_PINGS, MAX_WORKERS
    app = QApplication(sys.argv)
    tab_widget = QTabWidget()
    main_widget = QWidget()
    main_layout = QVBoxLayout(main_widget)
    main_layout.addWidget(tab_widget)
    main_widget.setLayout(main_layout)
    main_widget.setWindowTitle("Server Monitor - Alert")
    main_widget.setGeometry(300, 300, 1100, 600)
    clock_label = QLabel()
    clock_label.setAlignment(Qt.AlignRight | Qt.AlignVCenter)
    clock_label.setStyleSheet("font-size: 12pt;")
    def update_clock_label():
        current_time = QTime.currentTime().toString("hh:mm:ss")
        current_date = QDate.currentDate().toString("dd MMM yyyy")
        clock_label.setText(f"{current_date} - {current_time}    ")
    timer = QTimer()
    timer.timeout.connect(update_clock_label)
    timer.start(1000)  # Update every 1000ms (1 second)    
    clock_layout = QHBoxLayout()
    clock_layout.addStretch()
    clock_layout.addWidget(clock_label)
    main_layout.addLayout(clock_layout)
    main_window = OfflineHostMonitor(None, None, None, None)
    tab_widget.addTab(main_window, "Monitor")
    return_online_widget = ReturnOnlineWidget()
    tab_widget.addTab(return_online_widget, "Return Online")
    settings_widget = SettingsWidget(None, None, None, None, None, tab_widget, main_window)
    tab_widget.addTab(settings_widget, "Settings")
    main_window.settings_widget = settings_widget
    main_widget.show()
    file_path = 'hostname.txt'
    offline_state_file = 'offline_state.json'
    if not os.path.exists(file_path):
        QMessageBox.critical(None, "File Not Found", "The file 'hostname.txt' was not found. Exiting the application.")
        sys.exit()
    host_info_list, hostname_count = read_host_list(file_path)
    print(f"Number of hostnames in file: {hostname_count}")
    if not host_info_list:
        sys.exit()
    offline_dict = load_offline_state(offline_state_file)
    host_info_dict = {hostname.upper(): (hostname, store_name, telephone, wan_a, wan_b) for hostname, store_name, telephone, wan_a, wan_b in host_info_list}
    offline_dict = {hostname: details for hostname, details in offline_dict.items() if hostname in host_info_dict}
    queue = Queue()
    stop_event = threading.Event()
    cpu_count = psutil.cpu_count(logical=True)
    memory = psutil.virtual_memory()
    available_memory_gb = memory.available / (1024 ** 2)
    max_pings_based_on_memory = int(available_memory_gb / 0.1)
    MAX_PINGS = min(MAX_PINGS, max_pings_based_on_memory)
    semaphore = threading.Semaphore(MAX_PINGS)
    main_window.queue = queue
    main_window.offline_dict = offline_dict
    main_window.stop_event = stop_event
    main_window.semaphore = semaphore
    settings_widget.queue = queue
    settings_widget.offline_dict = offline_dict
    settings_widget.stop_event = stop_event
    settings_widget.semaphore = semaphore
    settings_widget.host_info_list = host_info_list
    return_online_signal = return_online_widget.dataUpdated
    for hostname, (host, store_name, telephone, wan_a, wan_b) in host_info_dict.items():
        threading.Thread(
            target=monitor_host,
            args=((host, store_name, telephone, wan_a, wan_b), queue, offline_dict, stop_event, semaphore, settings_widget.main_window),
            daemon=True
        ).start()
    threading.Thread(
        target=update_offline_list,
        args=(queue, offline_dict, stop_event, return_online_signal, settings_widget),
        daemon=True
    ).start()
    app.aboutToQuit.connect(lambda: save_offline_state(offline_state_file, offline_dict))
    app.aboutToQuit.connect(main_window.stop_all_threads)    
    sys.exit(app.exec_())

make show date and time to status bar