How to update RTC time in mini2440

Sushant
Hello,
I am using this command for set RTC time 
date +%T -s "11:56" 
its show invalid date ..
How to update time

davef
Try:

   hwclock --set --date "02/19/2013 15:00:00"

change to your current date and time!

davef
Actually, on advice from Juergen it is more appropriate to set your hwclock
to UTC and then date will be correct for your current timezone.

So, what I now do is:

set date correctly to your current date and time and then 
  hwclock -u --systohc

effectively setting your hwclock to UTC based on the system time (date).

davef
Let's try this again ... your title is inconsistent with your procedure.  I
can't set RTC time with the date command (At least as far as I can see).

hwclock sets your RTC time, but also you can set the system time (date)
with it.

Sushant
Hello,
   hwclock --set --date "02/19/2013 15:00:00"

hwclock: unrecognized option '--set'
BusyBox v1.13.0 (2009-07-29 12:03:34 CST) multi-call binary

Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-l|--localtime]
[-u|--utc] [-f FILE]

Query and set hardware clock (RTC)

Options:
        -r      Show hardware clock time
        -s      Set system time from hardware clock
        -w      Set hardware clock to system time
        -u      Hardware clock is in UTC
        -l      Hardware clock is in local time
        -f FILE Use specified device (e.g. /dev/rtc2)

its return help content any extra package for date command

davef
Sorry, that was for Ubuntu.  hwclock in Ubuntu and Busybox are slightly
different.

Set date then 

hwlock -uw

as in the other thread http://www.friendlyarm.net/forum/topic/828

davef
hwclock -u --systohc

mentioned earlier should work

sushant
Hello,
s3c2410-rtc s3c2410-rtc: rtc only supports 100 years
hwclock: RTC_SET_TIME: Invalid argument

sushant
Hello,

hwclock -u --systohc


hwclock: unrecognized option '--set'
BusyBox v1.13.0 (2009-07-29 12:03:34 CST) multi-call binary

Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-l|--localtime]
[-u|--utc] [-f FILE]

Query and set hardware clock (RTC)

Options:
        -r      Show hardware clock time
        -s      Set system time from hardware clock
        -w      Set hardware clock to system time
        -u      Hardware clock is in UTC
        -l      Hardware clock is in local time
        -f FILE Use specified device (e.g. /dev/rtc2)

same mas show.

thanks

davef
It looks like your Busybox doesn't recognise --systohc as -w option??

   hwclock -u --systohc works for me.  Did you try hwclock -uw as mentioned

Also, my Busybox version is 1.21.0


What do you get when you try:
   date

Do you get your local time and date?

Setting date:

   date -s "2013-10-18 08:23"

Sushant
Hello,
But i am restart mini2440 the time is reset its show 1969 year

davef
So, you know what the "time" was before it was reset?

First, do:
date -s "2013-10-18 08:23"

then on the command line type in date and hit enter ... what do you see?

Sushant
Hello,
hwclock -w 
Set on rcS file then poweroff the system for 1hr and check date is show Wed
Dec 31 19:00:16 EST 1969

means its not permantly set time...
i am very confuse my application is fully works on rtc and write current
time on file . for this problem i am  not able to write file in current
date & time ...

Juergen Beisert
Did you check your RTC battery is still alive?

Sushant
Hello,

I check rtc battery also..

davef
Show us the rcS file.  In the early FA distro some of these files were
mounted in tmpfs, which then meant they were volatile.

So, copy and paste the whole file for us to look at.

Milan Romic
Attachment: setTime (35.73 KB)
Hi!

Here is simple script which update RTC on Linux OS on FriendlyArm Mini2440.

Usage:
1. Copy script to FriendlyArm by FTP (use binary transfer mode)
2. Change permission (chmod 777 setTime)
3. Run it with ./setTime 22 12 1985 15:50:14

Also check RTC battery.

Milan Romic
UPDATE:

3. Run it with ./setTime 22 12 1985 15 50 14

Juergen Beisert
Milan, you binary is a really bad joke. m(

Milan Romic
Juergen, I am using this binary in my project, it works fine. What is your
experience?

Milan Romic
UPDATE:

Use YEAR above 2000.

3. Run it with ./setTime 15 04 2014 14 01 02

Juergen Beisert
> What is your experience?

Distributing a binary is only "it works for you". For all other people its
another source of pain.

well
Hi Milan,
thanks a lot for your script
already frustrated on my boards though.
it works like a charm for me.

Regards,

Well.

wellson.octo@gmail.com

hani
For sushaunt error : 
=======================================================================
Hello,
   hwclock --set --date "02/19/2013 15:00:00"

hwclock: unrecognized option '--set'
BusyBox v1.13.0 (2009-07-29 12:03:34 CST) multi-call binary

Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-l|--localtime]
[-u|--utc] [-f FILE]

Query and set hardware clock (RTC)

Options:
        -r      Show hardware clock time
        -s      Set system time from hardware clock
        -w      Set hardware clock to system time
        -u      Hardware clock is in UTC
        -l      Hardware clock is in local time
        -f FILE Use specified device (e.g. /dev/rtc2)

its return help content any extra package for date command
========================================================================
I have the same error like you. 
At first i do that : # date -s "2016-05-31 13:23"
then write this : # date -s "2016-05-31 13:23"
then both of them set the same
.
source : 
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7...