OS: Ubuntu
Version: 14.04
Language: C++11
I've written an application that needs to change the real-time clock based on different sources. As background, the reason that I'm not using NTP to manage this is based on different clock sources that are needed at different points, for all the current applications using CLOCK_REALTIME. This application receives a clock reference time and sets the clock using clock_settime
. This returns the message Operation not permitted
.
if(clock_settime(CLOCK_REALTIME, &timeRT) != 0)
{
std::cerr << " Set clock_settime(CLOCK_REALTIME, &timeRT) = " << strerror(errno) << std::endl;
}
I presume the applications privileges are not set correctly.
- Any direction on how to do this?
- Anything else I should check?
Copyright Notice:Content Author:「Otto Nahmee」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40613716/trying-to-change-realtime-clock-in-ubuntu-14-04-in-c-application-getting-ope