Application freezes after updating system clock in Linux operation system

I have a problem with my application when I try to change system clock.

My application written on C++ and I use gtk+ 2.xx library for UI and the board Toradex ARM Colibri T20.

After pressing button that receives date/time from user, it calls the system function:

  • const struct timeval tv = {configDate, 0};
  • settimeofday(&tv, 0);
  • system (“hwclock –systohc”);

after that the application freezes (main thread) while background threads continue running.

The same effect if

  1. I use : system(“date –s ‘……’”);
  2. I operate the command in
    background thread
  3. I create new
    process that operate the command
    (received date/time via arguments)

The command ‘date –s …’ works perfectly if it is executed from command line and also works perfect with c++ console application without gtk+ library.

Will really appreciate any idea how to fix it.

Thank you