// 監聽更新
function winUpdate(){// 每次執行完后重新設置定時器try {// 獲取當前時間并格式化為易讀的字符串const now = new Date();const timeString = now.toLocaleString();console.log(`當前時間: ${timeString}`);// 記錄內存使用情況(可選)const memoryUsage = process.memoryUsage();console.log(`內存使用: ${Math.round(memoryUsage.heapUsed / 1024 / 1024)} MB`);console.log('定時任務執行中...');}catch(error) {console.error('定時任務出錯:', error);}finally {// 無論如何都繼續下一次執行setTimeout(winUpdate, 1000);}
}
winUpdate()
長期穩定運行