2010-11-28 85 views
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

這裏是我的全部源代碼:

http://pastebin.com/sgBBv1XA

是的,我執行PROGRAMM爲根。

回答

1

我懷疑,如果有可能在虛擬環境中運行的機器中設置HD時鐘。

+0

VirtualBox是否不模擬虛擬RTC? – NKnusperer 2010-11-28 20:08:25