Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: manit123 on October 23, 2014, 09:17:29 PM

Title: set time date in raspberry pi b+ without internet
Post by: manit123 on October 23, 2014, 09:17:29 PM
hi
Which file/boot option should I edit so that picore does not try to access ntp server (as my device is on LAN without internet) & set time to some day in 2014 say 19-05-2014 9AM.
Otherwise , i have seen it defaults to january 1 1970 & says 'password expired' to ssh clients .
Title: Re: set time date in raspberry pi b+ without internet
Post by: bmarkus on October 24, 2014, 12:52:54 AM
Use date command in bootlocal.sh
Title: Re: set time date in raspberry pi b+ without internet
Post by: manit123 on October 25, 2014, 02:41:37 AM
okay . will try .
Title: Re: set time date in raspberry pi b+ without internet
Post by: manit123 on October 25, 2014, 12:35:45 PM
that worked.
does this try to get time from NTP ?
startup message shows 'skipping RTC' .
Title: Re: set time date in raspberry pi b+ without internet
Post by: bmarkus on October 25, 2014, 12:54:15 PM
It tries in the background few times but stops after few tries, doens't harm.
Title: Re: set time date in raspberry pi b+ without internet
Post by: Greg Erskine on October 25, 2014, 01:54:39 PM
startup message shows 'skipping RTC' .

RTC = real time clock (I think)
Title: Re: set time date in raspberry pi b+ without internet
Post by: manit123 on October 25, 2014, 07:19:55 PM
can i tell it not to try NTP & save time in boot ?
Title: Re: set time date in raspberry pi b+ without internet
Post by: bmarkus on October 26, 2014, 01:17:57 AM
can i tell it not to try NTP & save time in boot ?

Core waits 60 seconds for working network connection. If network is not available after 1 munute, do not check NTP time. As it was written in a previous it happenes in the background, do not slow down system,

No need to disable. Just do nothing :)
Title: Re: set time date in raspberry pi b+ without internet
Post by: Captain Murloc on December 12, 2014, 01:32:21 AM
Hello,

I'm quite new on Raspberry and I have to get automatically the date when my RPi is booting. You said :

Use date command in bootlocal.sh

My /opt/bootlocal.sh is void. Nothing is written in. Is it normal ? Maybe this /bootlocal.sh is not located into /opt folder but I only heard about this location.

If it is normal, how have I to use the date command here ?

Thanks for help and sorry for my english :x

-- Captain Murloc
Title: Re: set time date in raspberry pi b+ without internet
Post by: bmarkus on December 12, 2014, 01:42:56 AM
Is your RPi connected to Internet?
Title: Re: set time date in raspberry pi b+ without internet
Post by: Captain Murloc on December 12, 2014, 02:01:25 AM
For now, it is. But I need it to be able to update the date without Internet.

-- Captain Murloc
Title: Re: set time date in raspberry pi b+ without internet
Post by: bmarkus on December 12, 2014, 02:44:41 AM
Without Internet, there are two option.

1) Manually using date command
2) Adding an RTC (search Forum for tipps)
Title: Re: set time date in raspberry pi b+ without internet
Post by: Captain Murloc on December 12, 2014, 02:57:59 AM
1) Manually using date command
Hum, OK. I understood that but I don't know how to correctly use this command. Actually, I need to get the true date on each boot of the RPi.
I assume that I need to use the date command on boot putting it in a specific file, but in which file have I to put it so it runs automatically ?

2) Adding an RTC (search Forum for tipps)
I really don't want to add any module to my RPi. :)

Thanks.
Title: Re: set time date in raspberry pi b+ without internet
Post by: bmarkus on December 12, 2014, 03:08:41 AM
You must execute date command in a terminal.

Type

Code: [Select]
date --help
in terminal to get help on usage.

Title: Re: set time date in raspberry pi b+ without internet
Post by: Captain Murloc on December 12, 2014, 03:20:52 AM
In fact, when I type date in my terminal, I always get the following date :
Code: [Select]
Tue Sep   9 12:31:36 CEST 2014Only time is changing.
If I let my RPi turned on, of course, the date will change but when I turn it off and restart it, the date is still Tue Sep   9 xx:xx:xx CEST 2014

Of course, I used
Code: [Select]
dpkg-reconfigure tzdata and selected the good geographic area and time zone. But nothing changed.
Title: Re: set time date in raspberry pi b+ without internet
Post by: bmarkus on December 12, 2014, 03:47:32 AM
dpkg-something, eh? Are we talking about piCore, the Raspberry Pi port of Tiny Core Linux? Dion't think so....
Title: Re: set time date in raspberry pi b+ without internet
Post by: eno on December 12, 2014, 08:32:20 AM
that worked.
does this try to get time from NTP ?
startup message shows 'skipping RTC' .

I dont think Raspberry Pi has a RTC so that's correct (I have seen several projects to add an RTC to Raspberry Pi too BTW).
Title: Re: set time date in raspberry pi b+ without internet
Post by: eno on December 12, 2014, 10:33:09 AM
If I let my RPi turned on, of course, the date will change but when I turn it off and restart it, the date is still Tue Sep   9 xx:xx:xx CEST 2014

I imagine without a real-time clock, the RPi probably forgets the time every time you start? Which means you must manually set the daye & time OR add a RTC circuit OR use NTP.