QNX RTOS v4 Knowledge Base
  
QNX RTOS v4 Knowledge Base
  
    
      | 
          
            | Title | Problems with setting system clock after reboot. |  
            | Ref. No. | QNX.000003968 |  
            | Category(ies) | Utilities, Configuration |  
            | Issue | I am using qnx_setclock() to set the system time. After that when the system reboots, it shows the old time. I tried the same with 'date' command also to set a time. But after system reboots, it shows the old time. 
 How can I reslove this to show the new time after system reboots?
 
 |  
            | Solution | If you look in your sysinit file is there a line near the top that says rtc -h 
 If so that is where the problem is coming in.
 The 'rtc' utility is explained in the Utilities Manual
 
 http://qdn.qnx.com/support/docs/qnx4/utils/r/rtc.html
 
 Briefly it sets the real time clock. If you use the date utility to set the time, then after that you have to run 'rtc -s' to set the time on the real time clock to what you just told it with the 'date' command.
 
 If you make sure the line in your sysinit file is rtc -l hw and use the 'rtc -s' command when you change the time, you should have no problems.
 |  |