Setup time without ntp or the internet?

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
jimlynnjulian
DD-WRT Novice


Joined: 26 Oct 2024
Posts: 1

PostPosted: Sun Oct 27, 2024 19:50    Post subject: Setup time without ntp or the internet? Reply with quote
I attempted to use a PC app that controls Phillips Hue light bulbs through a Bridge connected to the router. The app complained of incorrect time settings.

The router is not connected to the web or another router that is. Is there a way to set the time on the dd-wrt router? I checked the Setup/Basic Setup page but ran into a dead end.

If I connect the router to the web long enough to set the time, will the correct time be maintained?

Thanks
Sponsor
Per Yngve Berg
DD-WRT Guru


Joined: 13 Aug 2013
Posts: 7123
Location: Romerike, Norway

PostPosted: Sun Oct 27, 2024 21:47    Post subject: Reply with quote
The time will be kept as long as the router is running. It does not have a Clock Battery, so time is lost with a reboot.

You can run a NTP Server on a PC or Server.
lazardo
DD-WRT User


Joined: 17 Apr 2014
Posts: 146
Location: SF Bay Area

PostPosted: Wed Nov 12, 2025 4:35    Post subject: Re: Setup time without ntp or the internet? Reply with quote
jimlynnjulian wrote:
...
The router is not connected to the web or another router that is. Is there a way to set the time on the dd-wrt router?
...


I use the following to set time from router running dd-wrt, to rpi-4 at boot.
Code:
DATE="$( ssh root@<router> date )"
if echo $DATE | grep -q ' P.T 20'; then
   date -s "$DATE"
fi

Notes:
* The 'date' command output from the time source must be in a format usable on the router (see below)
* The 'if/then' sanity check is for PST/PDT, not strictly needed.
* If scripted, you need to setup public key ssh between router and PC.
Code:
BusyBox v1.36.1 (2024-06-12 10:51:21 +07) multi-call binary.

Usage: date [OPTIONS] [+FMT] [[-s] TIME]

Display time (using +FMT), or set time

   -u      Work in UTC (don't convert to local time)
   [-s] TIME   Set time to TIME
   -d TIME      Display TIME, not 'now'
   -D FMT      FMT (strptime format) for -s/-d TIME conversion
   -r FILE      Display last modification time of FILE
   -R      Output RFC-2822 date
   -I[SPEC]   Output ISO-8601 date
         SPEC=date (default), hours, minutes, seconds or ns

Recognized TIME formats:
   @seconds_since_1970
   hh:mm[:ss]
   [YYYY.]MM.DD-hh:mm[:ss]
   YYYY-MM-DD hh:mm[:ss]
   [[[[[YY]YY]MM]DD]hh]mm[.ss]
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 13880
Location: Netherlands

PostPosted: Wed Nov 12, 2025 12:25    Post subject: Reply with quote
Just run an NTP Server on your rpi-4 and point your DDWRT router to your rpi-4 in the time settings
_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
ArjenR49
DD-WRT Guru


Joined: 05 Oct 2008
Posts: 852
Location: Helsinki, Finland / nr. Alkmaar, Netherlands

PostPosted: Tue Dec 09, 2025 22:32    Post subject: Reply with quote
A UPS hat for a raspberry pi may have a real time clock module built in that you could use with your time server.

I use a wittypi L3V7 UPS hat on a pi4 that runs PiHole, unbound and WireGuard on my home LAN.
The NTP server software is Chrony. The wittypi software doesn’t like chrony, but it can be coerced.
On another LAN in a different location I have a similar setup on a pi zero 2, without wireguard.

The router is set up to get the time from the local ntp server. So do most other clients. The chrony ntp server in its turn synchronizes with internet time servers only every 1000 sec.
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum