4

I'm working with a Linux embedded board. It uses Linux kernel v2.6.37 with an external I2C RTC cbc34803. I've successfully intergrated the RTC hardware. It works correctly except the problem synchronization between system time and hardware clock time.

As I know there're two types of time in Linux: system time and hardware clock time (RTC).

When system boots, the system time is set from hardware clock time. But when I change the system time with date command, the system time does not sync to the RTC. Of course, it'll be synced if I use hwclock -w command.

I want the system automatically update the system time to rtc (hardware clock) time everywhen the system time is changed. The question is which is responsibled for sync time from system time to rtc and what I need to do?

4

You could write a function that does both:

set_both_clocks() {
  date "$@"
  hwclock -w
}

Give it the exact same arguments you'd give to date when setting the system clock.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.