2
當我嘗試設置計算機硬件時鐘喜歡這裏descripted:設置硬件時鐘不工作
How Do You Programmatically Set the Hardware Clock on Linux?
它不工作(時間未更新爲新的時間)。
fd = open("/dev/rtc", O_RDONLY); //<- return 3
ioctl(fd, RTC_SET_TIME, &rt); //<- return 0
當我添加
system("/sbin/hwclock --systohc");
我得到:
無法通過 訪問硬件時鐘的任何已知方法
從終端執行hwclock的--systohc加工。
這是一個在VirtualBox中的Ubuntu 10.10 mashine。
使用代碼:: Blocks的10.05與GCC我4.4.5
這裏是我的全部源代碼:
是的,我執行PROGRAMM爲根。
VirtualBox是否不模擬虛擬RTC? – NKnusperer 2010-11-28 20:08:25