Author Topic: Date Keeping Problem  (Read 8905 times)

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Date Keeping Problem
« on: December 26, 2006, 08:08:16 am »
I'm not sure if this afflicts any other rom but it certainly afflicts pxaXrom beta4 and above.
Even if you set up the date correctly at each reboot or reset you loose the date. I'm not sure if the hardware has a hardware clock and even if it does I would not be able to write code to manage it in a reasonable amount of time ... so this is the work around I made:
I wrote a simple script in /etc/rc.d/init.d/fixdate that was able to save current time at shutdown and restore it at startup.
Unfortunately the /etc/rc.d/rc script is not working exactly as one would expect (one of the next things I'll try to fix) so I was unable to make the Kxxfixdate links in the desired runlevel directories ... but to get it working I added at the beginning of /etc/rc.d/init.d/halt a line that would run /etc/rc.d/init.d/fixdate stop.

Naturally if the PDA remains shutdown (not suspended) for a long period the time would be way off but still better that "Jan 1 1970".

Here is the script:

#!/bin/sh

. /etc/rc.d/init.d/functions

case "$1" in
  start)
    [ -r /var/tmp/savedate ] && \
      /bin/date -s "$(/bin/cat /var/tmp/savedate)"
  ;;
  stop) /bin/date > /var/tmp/savedate ;;
  *)
    echo "Usage: $0 {start|stop}"
    exit 1
  ;;
esac

exit 0
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

mathemajikian

  • Sr. Member
  • ****
  • Posts: 301
    • View Profile
    • http://exit3.i-55.com/~xikon/openbsdzaurus.html
Date Keeping Problem
« Reply #1 on: December 26, 2006, 09:16:26 am »
I don't think the Zaurus has a hardware clock like a normal computer. This is why ROM's like Cacko ask you for the correct time each time you reboot. The script you provide is fine but why not run ntpd at startup? If you have internet access your time will be correct each time you reboot and will be checked periodically throughout the day.If you don't have internet access then you can use the following command to set the date:

Code: [Select]
# date 8506131627
This sets the date to ``June 13, 1985, 4:27 PM''.
« Last Edit: December 26, 2006, 09:26:45 am by mathemajikian »

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Date Keeping Problem
« Reply #2 on: December 26, 2006, 11:38:03 am »
Quote
I don't think the Zaurus has a hardware clock like a normal computer. This is why ROM's like Cacko ask you for the correct time each time you reboot. The script you provide is fine but why not run ntpd at startup? If you have internet access your time will be correct each time you reboot and will be checked periodically throughout the day.If you don't have internet access then you can use the following command to set the date:

Code: [Select]
# date 8506131627
This sets the date to ``June 13, 1985, 4:27 PM''.

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

Ntpd date only works when you are connected to net ... so ntpd would be as good as leaving the date to the default (beginning of unix time) il all other cases.
Setting the date blindly is ok but my script reloads the last date saved which I think is better. When you are connected you could just run "ntpdate -b -s <your_ntpserver>" to sync the date immediately.

In any case to your command you would at least haveto add the -s option to tell date that you want to set the date ;-)
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

InSearchOf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1144
    • View Profile
    • http://
Date Keeping Problem
« Reply #3 on: December 26, 2006, 12:06:52 pm »
Quote
In any case to your command you would at least haveto add the -s option to tell date that you want to set the date ;-)
[div align=\"right\"][a href=\"index.php?act=findpost&pid=149136\"][{POST_SNAPBACK}][/a][/div]

No you dont... that command is fine....

Late
Sharp Zaurus SL-C3100 and SL-6000L
pdaXrom Developer
Please visit pdaXrom.org for updates
My Blog
IRC #pdaxrom @ FreeNode

koen

  • Hero Member
  • *****
  • Posts: 1008
    • View Profile
    • http://dominion.thruhere.net/koen/cms/
Date Keeping Problem
« Reply #4 on: December 26, 2006, 02:02:31 pm »
Quote
I don't think the Zaurus has a hardware clock like a normal computer.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=149122\"][{POST_SNAPBACK}][/a][/div]

It has a rtc, but it isn't battery backed, and to make it worse the stock bootloader (and the 2.4.crappix kernel!) resets it on reboot.
Forums are not bugtrackers!!! Smart questions
Ångström release team
iPAQ h2210, iPAQ h5550, iPAQ hx4700, Zaurus SL-C700, Nokia 770, all running some form of GPE
My blog

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Date Keeping Problem
« Reply #5 on: December 26, 2006, 02:26:12 pm »
Quote
Quote
In any case to your command you would at least haveto add the -s option to tell date that you want to set the date ;-)
[div align=\"right\"][a href=\"index.php?act=findpost&pid=149136\"][{POST_SNAPBACK}][/a][/div]

No you dont... that command is fine....

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

Well on my 760 running r121 when I issue

date 8506131627

I get "invalid date" ... same on my slackware linux x86 ... so I guess really something is wrong with the command.
The correct format is: MMDDhhmm[[CC]YY][.ss]
So maybe

date 0613162785

would be the right command  for the desigred date ;-)
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

InSearchOf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1144
    • View Profile
    • http://
Date Keeping Problem
« Reply #6 on: December 26, 2006, 02:29:36 pm »
Quote
Quote
Quote
In any case to your command you would at least haveto add the -s option to tell date that you want to set the date ;-)
[div align=\"right\"][a href=\"index.php?act=findpost&pid=149136\"][{POST_SNAPBACK}][/a][/div]

No you dont... that command is fine....

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

Well on my 760 running r121 when I issue

date 8506131627

I get "invalid date" ... same on my slackware linux x86 ... so I guess really something is wrong with the command.
The correct format is: MMDDhhmm[[CC]YY][.ss]
So maybe

date 0613162785

would be the right command  for the desigred date ;-)
[div align=\"right\"][a href=\"index.php?act=findpost&pid=149146\"][{POST_SNAPBACK}][/a][/div]

date 1226142706

that is now... well when I typed it...

but the reason you get the invalid date is is because there is no 85th month... I think he put the wrong #'s in the wrong place... I wrote that it is good meaning with out the "-s"

Late
Sharp Zaurus SL-C3100 and SL-6000L
pdaXrom Developer
Please visit pdaXrom.org for updates
My Blog
IRC #pdaxrom @ FreeNode

mathemajikian

  • Sr. Member
  • ****
  • Posts: 301
    • View Profile
    • http://exit3.i-55.com/~xikon/openbsdzaurus.html
Date Keeping Problem
« Reply #7 on: December 26, 2006, 02:53:31 pm »
Sorry for the confusion. The date/time format I listed is correct for BSD distros,  but for Linux distros it's in a different format.
« Last Edit: December 26, 2006, 02:54:00 pm by mathemajikian »

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Date Keeping Problem
« Reply #8 on: December 26, 2006, 03:19:08 pm »
Ok ...

Well whatever I still think that setting and saving with a human readable format is the most convenient.

The following command speaks for it self as to what the date is being set to:

date -s "Tue Dec 26 20:56:33 CET 2006"

And should work on all linux systems
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

Drake01

  • Full Member
  • ***
  • Posts: 226
    • View Profile
Date Keeping Problem
« Reply #9 on: December 26, 2006, 06:16:11 pm »
Quote
I'm not sure if this afflicts any other rom but it certainly afflicts pxaXrom beta4 and above.
Even if you set up the date correctly at each reboot or reset you loose the date.
...
[div align=\"right\"][{POST_SNAPBACK}][/a][/div]
I don't know if you're running atd, but the thread below mentions some issues you need to address if you are.  The atd daemon will lock the hardware clock and prevent you from setting it properly.

[a href=\"https://www.oesf.org/forums/index.php?showtopic=17326#]https://www.oesf.org/forums/index.php?showtopic=17326#[/url]
Device: SL-C3200 running pdaXii13v2 build 5.5.0
Networking: Symbol Spectrum24 WLAN card; Kingston CIO10T CF NIC
Storage: 4GB Transcend 150x SD; 16GB Transcend 133x CF; 4GB Seagate CF HDD; 4GB Patriot SD
HID: Logitech V450 Laser Mouse; generic silicone USB keyboard; 2 generic optical mice; stock plastic stylus
GPS: generic "UT-41" USB GPS Receiver
Case: neoprene case from my old Palm foldable keyboard

dinorex

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • http://dinorex.mocasting.com
Date Keeping Problem
« Reply #10 on: December 27, 2006, 08:42:59 am »
I don't know my experience can be helpful to you or not, but it is my findings.

If you make use of the matchbox and use the 'Settings -> Date & Time' or equivalently : datentime.py in console prompt (for all other windows manager), you can adjust the date time PERMANENTLY before you have taken the battery out on reboot (i.e. warm boot the zaurus you still keep the date / time upon kernel initialization)...

Maybe there are some tricks in the datentime.py applied in housekeeping the date/time, you can investigate that further inside....  

About the timezone, isn't it to be kept by the env'tal var "TZ"? I am quite confused....  
« Last Edit: December 27, 2006, 09:25:51 am by dinorex »
Dinorex corner: -
Chinese: http://dinorex.mocasting.com/
English: http://dinorex-redoxin.blogspot.com/
Website: http://dinorex.no-ip.biz/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Zauri SL-C3100 (1 black & 1 grey)
black - Qtopia / Cacko (for notes taking in meetings) :)
grey - ROM wild tester....

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Date Keeping Problem
« Reply #11 on: December 28, 2006, 06:50:13 am »
Quote
I don't know if you're running atd, but the thread below mentions some issues you need to address if you are.  The atd daemon will lock the hardware clock and prevent you from setting it properly.
https://www.oesf.org/forums/index.php?showtopic=17326#
[div align=\"right\"][a href=\"index.php?act=findpost&pid=149174\"][{POST_SNAPBACK}][/a][/div]
No I'm not using atd and the time gets set correctly by the script I suggested.
I have'nt tryed what happens with atd active though.

Quote
I don't know my experience can be helpful to you or not, but it is my findings.
If you make use of the matchbox and use the 'Settings -> Date & Time' or equivalently : datentime.py in console prompt (for all other windows manager), you can adjust the date time PERMANENTLY before you have taken the battery out on reboot (i.e. warm boot the zaurus you still keep the date / time upon kernel initialization)...
Maybe there are some tricks in the datentime.py applied in housekeeping the date/time, you can investigate that further inside.... 
About the timezone, isn't it to be kept by the env'tal var "TZ"? I am quite confused.... 
[div align=\"right\"][a href=\"index.php?act=findpost&pid=149237\"][{POST_SNAPBACK}][/a][/div]
Using the r121 on c760 at each reboot  the time gets lost even if I use the gui tool.
I agree with KOEN ... i'ts a hardware design flaw that may not afflict all zaurii ... maybe the c1000 and c3x00 have a battery backed hardware clock.
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

mathemajikian

  • Sr. Member
  • ****
  • Posts: 301
    • View Profile
    • http://exit3.i-55.com/~xikon/openbsdzaurus.html
Date Keeping Problem
« Reply #12 on: December 28, 2006, 07:33:31 am »
Quote
maybe the c1000 and c3x00 have a battery backed hardware clock.

I know that the C3100 and C3200 don't.  Not sure about the c1000.

koen

  • Hero Member
  • *****
  • Posts: 1008
    • View Profile
    • http://dominion.thruhere.net/koen/cms/
Date Keeping Problem
« Reply #13 on: December 28, 2006, 07:39:50 am »
Quote
Quote
maybe the c1000 and c3x00 have a battery backed hardware clock.

I know that the C3100 and C3200 don't.  Not sure about the c1000.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=149302\"][{POST_SNAPBACK}][/a][/div]

AFAIK only collie has a battery backed RTC
Forums are not bugtrackers!!! Smart questions
Ångström release team
iPAQ h2210, iPAQ h5550, iPAQ hx4700, Zaurus SL-C700, Nokia 770, all running some form of GPE
My blog

InSearchOf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1144
    • View Profile
    • http://
Date Keeping Problem
« Reply #14 on: December 28, 2006, 08:07:49 am »
Quote
Using the r121 on c760 at each reboot  the time gets lost even if I use the gui tool.
I agree with KOEN ... i'ts a hardware design flaw that may not afflict all zaurii ... maybe the c1000 and c3x00 have a battery backed hardware clock.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=149300\"][{POST_SNAPBACK}][/a][/div]

I believe the issue with the c760's is that there is a script that runs at shutdown... that syncs system clock to hardware clock (RTC)... well for some reason "hwclock" wasn't include in that model sets rom... I will have to talk to sash to confirm... but if that is the issue it will be included in the next release...

Late
Sharp Zaurus SL-C3100 and SL-6000L
pdaXrom Developer
Please visit pdaXrom.org for updates
My Blog
IRC #pdaxrom @ FreeNode