Clock update

Akita

Active member
I have addressed this before.
The clock is not updated continuously with settings:
NTP server pool.ntp.org
NTP sync interval 30 min.
Should I use a different NTP server?
If I Restart Enigma2 the clock is set to the correct time.
 
To provide a solution, one must first see the problem! Can you use telnet (Putty)? It would probably help to put a script in the receiver and log the time for a bit. This might give a clue as to what is happening. Installing and running a time monitoring script is not hard to do, but you need to be familiar with telnet, and it would also help to have the ability to transfer files to the receiver.

Here is a script that I am using:
(Copy and Paste this entire code block in Telnet, then press Enter)
Code:
cat > /tmp/ntp_timecheck.sh << 'EOF'
#!/bin/sh
# Enigma2 time monitoring script using pool.ntp.org
# Compare receiver time with the same NTP server the receiver uses

LOGFILE="/tmp/timecheck.log"

# Function to log time comparison
log_time() {
    echo "=== $(date '+%Y-%m-%d %H:%M:%S') ===" >> $LOGFILE
    echo "Receiver time: $(date)" >> $LOGFILE
    
    # Try rdate first (most reliable for comparison)
    if NTP_TIME=$(rdate -p pool.ntp.org 2>/dev/null); then
        echo "NTP pool.ntp.org: $NTP_TIME" >> $LOGFILE
        # Calculate time difference if both times are available
        echo "Status: SUCCESS - NTP connection established" >> $LOGFILE
    else
        # Try alternative NTP servers
        if NTP_TIME=$(rdate -p time.nist.gov 2>/dev/null); then
            echo "NTP time.nist.gov: $NTP_TIME" >> $LOGFILE
            echo "Status: pool.ntp.org failed, time.nist.gov worked" >> $LOGFILE
        elif NTP_TIME=$(rdate -p time.google.com 2>/dev/null); then
            echo "NTP time.google.com: $NTP_TIME" >> $LOGFILE
            echo "Status: pool.ntp.org failed, time.google.com worked" >> $LOGFILE
        else
            echo "NTP Status: ALL NTP servers failed to connect" >> $LOGFILE
            # Try HTTP fallback
            if HTTP_TIME=$(curl -I google.com 2>/dev/null | grep -i date | cut -d' ' -f2-); then
                echo "HTTP fallback: $HTTP_TIME" >> $LOGFILE
            else
                echo "HTTP fallback: FAILED" >> $LOGFILE
            fi
        fi
    fi
    echo "" >> $LOGFILE
}

# Check if script is already running
if [ -f /tmp/timecheck.pid ]; then
    PID=$(cat /tmp/timecheck.pid)
    if kill -0 $PID 2>/dev/null; then
        echo "Time monitoring already running (PID: $PID)"
        exit 1
    fi
fi

# Save our PID
echo $$ > /tmp/timecheck.pid

# Initialize log file
echo "NTP Time monitoring started at $(date)" > $LOGFILE
echo "Primary: pool.ntp.org (same as Enigma2)" >> $LOGFILE
echo "Fallbacks: time.nist.gov, time.google.com, HTTP" >> $LOGFILE
echo "Checking every 5 minutes..." >> $LOGFILE
echo "" >> $LOGFILE

# Main monitoring loop
while true; do
    log_time
    sleep 300  # 5 minutes
done
EOF
Make it executable (Telnet commands in bold. Press Enter after each command):
chmod +x /tmp/ntp_timecheck.sh
Run it:
/tmp/ntp_timecheck.sh &
Log it:
tail -f /tmp/timecheck.log

Here is what my output looks like for roughly one hour. And Yes, There is a problem!
Code:
root@sf8008:~# tail -f /tmp/timecheck.log
NTP Time monitoring started at Tue Aug 19 22:56:54 EDT 2025
Primary: pool.ntp.org (same as Enigma2)
Fallbacks: time.nist.gov, time.google.com, HTTP
Checking every 5 minutes...

=== 2025-08-19 22:56:54 ===
Receiver time: Tue Aug 19 22:56:54 EDT 2025
NTP Status: ALL NTP servers failed to connect
HTTP fallback: Wed, 20 Aug 2025 02:57:14 GMT

=== 2025-08-19 23:02:14 ===
Receiver time: Tue Aug 19 23:02:14 EDT 2025
NTP time.nist.gov: Tue Aug 19 23:02:25 2025
Status: pool.ntp.org failed, time.nist.gov worked

=== 2025-08-19 23:07:24 ===
Receiver time: Tue Aug 19 23:07:24 EDT 2025
NTP Status: ALL NTP servers failed to connect
HTTP fallback: Wed, 20 Aug 2025 03:07:45 GMT

=== 2025-08-19 23:12:45 ===
Receiver time: Tue Aug 19 23:12:45 EDT 2025
NTP time.nist.gov: Tue Aug 19 23:12:55 2025
Status: pool.ntp.org failed, time.nist.gov worked

=== 2025-08-19 23:17:55 ===
Receiver time: Tue Aug 19 23:17:55 EDT 2025
NTP Status: ALL NTP servers failed to connect
HTTP fallback: Wed, 20 Aug 2025 03:18:15 GMT

=== 2025-08-19 23:23:15 ===
Receiver time: Tue Aug 19 23:23:15 EDT 2025
NTP Status: ALL NTP servers failed to connect
HTTP fallback: Wed, 20 Aug 2025 03:23:26 GMT

=== 2025-08-19 23:28:26 ===
Receiver time: Tue Aug 19 23:28:26 EDT 2025
NTP time.nist.gov: Tue Aug 19 23:28:36 2025
Status: pool.ntp.org failed, time.nist.gov worked

=== 2025-08-19 23:33:36 ===
Receiver time: Tue Aug 19 23:33:36 EDT 2025
NTP time.nist.gov: Tue Aug 19 23:33:46 2025
Status: pool.ntp.org failed, time.nist.gov worked

=== 2025-08-19 23:38:46 ===
Receiver time: Tue Aug 19 23:38:46 EDT 2025
NTP Status: ALL NTP servers failed to connect
HTTP fallback: Wed, 20 Aug 2025 03:38:56 GMT

=== 2025-08-19 23:43:56 ===
Receiver time: Tue Aug 19 23:43:56 EDT 2025
NTP time.nist.gov: Tue Aug 19 23:44:07 2025
Status: pool.ntp.org failed, time.nist.gov worked

=== 2025-08-19 23:49:06 ===
Receiver time: Tue Aug 19 23:49:06 EDT 2025
NTP time.nist.gov: Tue Aug 19 23:49:07 2025
Status: pool.ntp.org failed, time.nist.gov worked

=== 2025-08-19 23:54:07 ===
Receiver time: Tue Aug 19 23:54:07 EDT 2025
NTP Status: ALL NTP servers failed to connect
HTTP fallback: Wed, 20 Aug 2025 03:54:27 GMT

=== 2025-08-19 23:59:27 ===
Receiver time: Tue Aug 19 23:59:27 EDT 2025
NTP time.nist.gov: Tue Aug 19 23:59:38 2025
Status: pool.ntp.org failed, time.nist.gov worked
 
The attached log file is a 10 plus hour log of the receiver time taken every 5 minutes. The receiver did not lose any time, but I do have problems it seems with pool.ntp.org. I will consider writing a script or adding code for my uses to have HTTP as a fallback. But again, the receiver did not lose any time, and still shows the correct time within reason.

I did a test once of the Edision 4K receiver and ran it for about a month without allowing it to update the time. The receiver did a good job of keeping the correct time and was off by some seconds at the end of the month. The Edision and probably most other fta receivers have at minimum a decent internal clock.

There does not seem to be anything wrong with the time-keeping of the current Open Black Hole image. I have tested other images with this time keeping script and get similar results. Improvements could be made by adding HTTP as a fallback as it appears to work every time in this test. pool.ntp.org Failed badly in this test, but again, the receiver kept the correct time. Shown in the screencap below are the time settings I used in the receiver menus.

You Cannot Fix What Is Not Broken!

OBH-Time_20250820190555.jpg
 

Attachments

Back
Top