Author Topic: Setting Time  (Read 1795 times)

pisto

  • Newbie
  • *
  • Posts: 9
    • View Profile
Setting Time
« on: January 24, 2006, 03:01:30 am »
Hello,
  last days I have had big problems trying to set date and time in my C1000. After searching the forums I found no working answer.
  Command "date" worked, command "hwclock" gave me an error related to "/dev/rtc" file impossible to open.
  but, if I tried changing time from Settings in matchbox, the system hung up!
  Later I have studied a little my configuration and I tried all these operations with "atd" daemon stoped. ALL worked again!
  So, my question, can this be true? Is there any solution for this, in order to automate the date-time changing from X-Windows?

Thanks!

karlto

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
    • http://
Setting Time
« Reply #1 on: January 24, 2006, 05:46:37 pm »
Quote
Hello,
  last days I have had big problems trying to set date and time in my C1000. After searching the forums I found no working answer.
  Command "date" worked, command "hwclock" gave me an error related to "/dev/rtc" file impossible to open.
  but, if I tried changing time from Settings in matchbox, the system hung up!
  Later I have studied a little my configuration and I tried all these operations with "atd" daemon stoped. ALL worked again!
  So, my question, can this be true? Is there any solution for this, in order to automate the date-time changing from X-Windows?

Thanks!
[div align=\"right\"][a href=\"index.php?act=findpost&pid=112127\"][{POST_SNAPBACK}][/a][/div]

That's correct - atd locks /dev/rtc (the hardware clock) while running, so you do have to stop it before setting the time.

The matchbox applets are mostly python - perhaps someone has the time to look through /usr/bin/datentime.py to see if some logic can be added to stop/start atd if/where required?
SL6000-L, RC12

alexei

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • http://
Setting Time
« Reply #2 on: May 23, 2006, 07:36:18 am »
I ran into this problem recently (1.1.0beta1). How about modifying
/etc/apm/scripts.d/hwclock to read

suspend() {
  # first need to turn off atd for this to work
  /etc/rc.d/init.d/atd stop  
  hwclock --systohc
  return 0
}

resume() {
  hwclock --hctosys
  /etc/rc.d/init.d/atd start
  return 0
}


will this break anything else?
C3100 RC12

karlto

  • Sr. Member
  • ****
  • Posts: 343
    • View Profile
    • http://
Setting Time
« Reply #3 on: May 23, 2006, 05:35:17 pm »
Quote
I ran into this problem recently (1.1.0beta1). How about modifying
/etc/apm/scripts.d/hwclock to read

suspend() {
  # first need to turn off atd for this to work
  /etc/rc.d/init.d/atd stop 
  hwclock --systohc
  return 0
}

resume() {
  hwclock --hctosys
  /etc/rc.d/init.d/atd start
  return 0
}


will this break anything else?
[div align=\"right\"][a href=\"index.php?act=findpost&pid=128165\"][{POST_SNAPBACK}][/a][/div]
I doubt that would break anything - if you didn't want to see an error, you'd probably need to add something like:

Code: [Select]
# stop atd (but only if it's running)
if [ -n "$(ps | grep atd | grep -v grep)" ]; then
  /etc/rc.d/init.d/atd stop
fi

and

Code: [Select]
# start atd (but only if service installed and enabled)
if [ -x /etc/rc.d/init.d/atd ]; then
  /etc/rc.d/init.d/atd start
fi
SL6000-L, RC12