when i try to set the computer hardware clock like here descripted:
How Do You Programmatically Set the Hardware Clock on Linux?
its开发者_开发技巧 not working (the time is not updated to the new time).
fd = open("/dev/rtc", O_RDONLY); //<- return 3
ioctl(fd, RTC_SET_TIME, &rt); //<- return 0
When I add
system("/sbin/hwclock --systohc");
I get:
Cannot access the Hardware Clock via any known method
Executing hwclock --systohc from the terminal working.
It's a Ubuntu 10.10 mashine in VirtualBox.
I using Code::Blocks 10.05 with GCC 4.4.5
Here is my full source code:
http://pastebin.com/sgBBv1XA
And yes, I execute the programm as root.
I doubt, if it is possible to set HD clock in a machine running in virtual environemnt.
精彩评论