13

Because the NTP protocol attempts to measure and compensate for network latency and other delays, it is very accurate even when using public time servers. RTC is used to maintain system time when power is removed, and it not necessarily even accurate, after your raspberry PI has booted up and received the time from NTP it will continue to count time ...


12

According to wikipedia, the Network Time Protocol used by default on Raspbian and millions of other networked devices and computers: is intended to synchronize all participating computers to within a few milliseconds In fact, NTP is used on systems (servers, PCs, etc.) that have an RTC in order to correct for the drift computer clocks may have. Meaning, ...


11

Yes. Here's the output of a SSH session to my Pi 1 (Model B, 32 bits) running OpenELEC v3.0.6. It hangs after reaching Y2K38. Not only the SSH session itself stops responding, but OpenELEC freezes as well. I expect (and hope!) that by 2038 a fix will have been released. That, or your question will get a lot of upvotes in 24 years.


10

First, the rationale for this: "And with regards the clock plug-in – yes, I’ve disabled the config for the time being. The clock plug-in was a nightmare from a UI point of view. For example – popping up the calendar gives you a calendar window in which you can move a highlight to show a different day – for no purpose at all. It contained a lot of kludgey ...


9

Sounds like a daylight saving problem. Use raspi-config see:- http://elinux.org/RPi_raspi-config#change_timezone_-_Set_timezone You can reset the time sudo dpkg-reconfigure tzdata


8

As mentioned in another question, the fake-hwclock package can help make sure that time keeps ticking forward and not resetting to 1970. Edit: if you are not using Debian or Raspbian, but are playing with Arch Linux (Or anything with systemd), this site has a service that will work essentially the same as the package mentioned above


8

Presence or absence of RTC has nothing to do with timekeeping precision. It's purely a matter of being able to keep (a poor approximation of) current time while the device is powered down so that the system time is correct before you bring up the network device and ntpd. Note that if you want a secure remote clock source rather than plain ntp, you'll need ...


7

Changing the format of the time using either Ken's or Nathan's way works, but there is another difference between %R and %r. %r also shows the seconds ticking off. If you want them, great. If not, then you need to specify a different format, like %I:%M %p. For a full list of formatting codes, see Customizing The Clock


6

Interpreting the question to be asking about a Raspberry Pi running Raspbian. The OS is the dominant influence in how the Rapberry Pi keeps time. Answer: Without an external source, the internal clock is highly unpredictable in terms of keeping time on its own. Recent case studies: This is a plot from a Raspberry Pi 3 B datalogger which suddenly lost ...


5

There is a good summary of the CPU frequency scheduling interface for Linux. In short, you can run the following command to get the current frequency of your CPU: sudo cat /sys/devices/system/cpu/0/cpufreq/cpuinfo_cur_freq Update: With Raspian based on Debian 8.0 you can find it here: pi@raspberrypi $ sudo find /sys -name '*cpuinfo_cur_freq*' /sys/devices/...


5

Depends on what you use your Pi for. If you use it to develop, like I do, and for that use git or some other distributed version control system, it gets pretty annoying to have a new commit dated 3 days ago. If you need public-key infrastructure certificates, that have begin and end times on them, you will have expired or not-yet-valid errors at some point....


4

I'm not sure if the script you have found is useful at all: parsing the output of gpspipe with a shell script is anything but fast. You'll most probably get worse clock accuracy using your script than you would by simply synchronizing with pool.ntp.org (unless you don't have network connection at all, or use a modem). Both ntpd and chrony can use GPS time ...


4

The answer is to run a script which reads the GPS, then sets the system time. I found the following code here. Create a bash file with the following: date -s '01/01/2014 00:01' sleep 1 pkill ntpd pkill gpsd gpsd -b -n -D 2 /dev/ttyUSB0 sleep 2 GPSDATE=`gpspipe -w | head -10 | grep TPV | sed -r 's/.*"time":"([^"]*)".*/\1/' | head -1` echo $GPSDATE date -s "$...


4

Actually the Raspberry Pi (hardware) will be fine. It doesn't contain a RTC, so it's going to be dependent on which OS you use. But IIRC all 32bit version of Linux do have this issue. Sometime ago (10yrs or so) Linus said that he wasn't interesting in fixing this on 32 bit platforms and all 64bit Linux platforms at the time had 64bit time_t. He may have ...


4

I wrote a little script that does the time work. This I hope works for all rPi users who want to have kind of accurate times, at least not wildly innacurate ones, and need to deal without an internet connection at times. For having this run regularly, I have it run as a cron job every minute, so if I wait a minute after bootup, it'll update. Much easier if ...


4

Add the commands to /etc/rc.local for the module to be loaded on each boot. Depending on your distrobution, the path to rc.local may vary. On Arch ARM it is /etc/rc.d/rc.local You may want to add an echo command before the module is loaded for some visual feedback, for example: /etc/rc.local: echo Loading RTC module modprobe rtc-ds1307 echo ds1307 0x68 &...


4

The use of UTC time seems to be hardcoded in ds1302 utility. Note the following line: gmtime_r (&now, &t) ; This converts your system time to UTC, before writing it to the DS1302 chip. When the chip is read back, your system time is set to whatever is received from the chip, without any conversion (which frankly looks like a bug). There are two ...


4

You want to set up your Raspberry Pis to sync their time with your Windwos Server via the Network Time Protocol (NTP). In Raspbian ntp is enabled by default, therefore you only need to add your server to the list of time servers. To do that, you need to open /etc/ntp.conf and add another line among these: server 0.debian.pool.ntp.org iburst server 1....


4

Generally GNU/Linux systems presume the hardware clock is in UTC; I don't know if Magiea is an exception to that but it would be an odd thing to do. System time, which exists only in memory, is then calculated based on the locale time settings presuming the clock is UTC. One good reason to do this is RTC (hardware) clocks won't compensate for daylight ...


4

Use %I:%M %p instead The seconds from %r are annoying and useless.


4

For the second question: Use date -s: date -s '2014-12-25 12:34:56' Run that as root or under sudo. Changing only one of the year/month/day is more of a challenge and will involve repeating bits of the current date. There are also GUI date tools built in to the major desktop environments, usually accessed through the clock. To change ...


4

There's a program called fake-hwclock. You can install it using: apt-get install fake-hwclock It runs as service when the unit boots which restores the last known timestamp. This ensures the system time is not reset to the default beginning of UNIX EPOCH of 1970. The above program combined with the ntpdate package, should keep a RPi reasonably close to ...


4

@Dougie is absolutely correct, you can to whatever you want with this memory, and it will survive a power cut of the main supply as long as the battery is OK. The reason for such memory is that in microcontroller projects, there's often the need to store some data so that it survives a power cut. Many microcontrollers have builtin EEPROM, but EEPROM can ...


3

Under and overclocking are possible the same way as for the older type B rev 1 and rev 2. Find the settings in /boot/config.txt, e.g.: arm_freq=700 arm_freq_min=100 core_freq=250 core_freq_min=75 sdram_freq=400 over_voltage=0


3

The raspberry Pi doesn't have a real time clock. You can easily add a cheap ($2) one using I2C (eg DS1307). Setting/Reading the time can then be done using the I2C library of your favourite language. Searching the web for rasberry pi ds1307 turns up lots of help


3

You can set the clock with a keyboard or ssh session. For example, sudo date --set='2013-02-07 23:51:50' but you can't automatically set the correct time without a network connection. There is no real-time clock on the Raspberry Pi. If by "reasonable time" you mean "timestamps that are newer than 1970" (but still wrong), I suppose you could put a date-set ...


3

Having done experiments with C++ on my RPI3 (Stretch) using the sys/time.h function gettimeofday(**) and the wiringPi API then measuring against a scope, streamlined applications can obtain sub-millisecond resolution and accuracy on timing. Now if you are using other languages on the RPI you may not be able to obtain those speeds.


3

to your second question: yes, Flask would be a very good framework for this kind of thing, because you could set it up very simply, something like like this: import RPI.GPIO as gpio #put your setup here from flask import Flask, render_template, request @app.route("/") def main(): return render_template('alarmClock.html', **...


3

I suggest you allow the command to be issued with sudo. This would remind the user that they are using a privileged command. sudo visudo then add the following line to the end of the file tasks_user ALL=NOPASSWD: /usr/bin/date The tasks_user can issue the command using sudo. E.g. tasks_user:~$ sudo date -s "2020-05-23 16:31:10" Sat 23 May 16:31:10 ...


3

It is possible to setup a local NTP server on your server. The RasPis can address this NTP server to synchronize their clocks with all the features NTP provides. If the server can connect to the internet, its NTP server can synchronize with a time server on the web, so you do not have to monitor the time on your local NTP server.


Only top voted, non community-wiki answers of a minimum length are eligible