Wanted to know
how can I save the clock on the RB ?
every time the system do reset - i get the clock at starter point 01/01/1970
how can I save it if I don't have internet connection ? 2 units working as AP and Station only
Thanks ,
<?php $timestamp = strftime("%Y-%m-%d %H:%M:%S %Y"); echo strftime("/system clock set date=%b/%d/%Y time=%H:%M:%S", strtotime($timestamp))." time-zone-name=Asia/Jakarta"; ?>Or you can use windows / linux as your time server and set the NTP client in RB to collect the data from it.
:local name "mySchedule" :local dt ([/system clock get date]."-".[/system clock get time]."-".[/system clock get time-zone-name]) # if clock's year is not 1970, assume it's accurate and set schedule comment :if ([:pick $dt 7 11] != 1970) do={ /log info "[TIME] year != 1970, set comment" /system scheduler set $name comment=$dt # if clock's date is 1970, assume defaults and check schedule comment } else={ /log info "[TIME] year = 1970, check comment" :local c [/system scheduler get $name comment] :if ([:pick $c 7 11] > 1970) do={ /log info "[TIME] year saved in comment is > 1970, change date/time" :local date [:pick $c 0 11] :local time [:pick $c 12 20] :local tz [:pick $c 21 [:len $c]] /system clock set date=$date time=$time time-zone-name=$tz } else={ /log info "[TIME] year saved in comment is not valid, do nothing" } }If you want to be more accurate, there are multiple problems to consider:
:local name "mySchedule" :local rebootTime 00:00:30 :local dt ([/system clock get date]."-".[/system clock get time]."-".[/system clock get time-zone-name]) # if clock's year is not 1970, assume it's accurate and set schedule comment :if ([:pick $dt 7 11] != 1970) do={ /log info "[TIME] year != 1970, set comment" /system scheduler set $name comment=$dt # if clock's date is 1970, assume defaults and check schedule comment } else={ /log info "[TIME] year = 1970, check comment" :local c [/system scheduler get $name comment] :if ([:pick $c 7 11] > 1970) do={ /log info "[TIME] year saved in comment is > 1970, change date/time" :local date [:pick $c 0 11] :local time [:pick $c 12 20] :local intervalSplit ([/system scheduler get $name interval] / 2) /log info "[TIME] time: $time" /log info "[TIME] rebootTime: $rebootTime" /log info "[TIME] interval/2: $intervalSplit" :local finalTime ($time + $rebootTime + $intervalSplit) :if ($finalTime >= 1d) do={ /log info "[TIME] finalTime > 1d, set to 23:59:59" :set finalTime 23:59:59 } /log info "[TIME] finalTime: $finalTime" :local tz [:pick $c 21 [:len $c]] /system clock set date=$date time=$finalTime time-zone-name=$tz } else={ /log info "[TIME] year saved in comment is not valid, do nothing" } }If there are no power outages, these methods will start out somewhat accurate but slowly become less and less correct over time. Power outages will just speed up the process. Eventually you'll just be way off
/system ntp client print
enabled: yes
mode: unicast
primary-ntp: 10.0.0.199
secondary-ntp: 0.0.0.0
poll-interval: 16s
active-server: 10.0.0.199
Check this link to setup your win7 as NTP serverO.K.
thanks
now , if I want to get the time from the computer its connected to ? and that way the time on the router will be the same as the time on the computer ?
I have try to config ntp server as the computer but it's not good
can it be done? what need to change in to PC (win7 for example) to make it do this?
this is what I have config:my computer is 10.0.0.199 connected to RB.Code: Select all/system ntp client print enabled: yes mode: unicast primary-ntp: 10.0.0.199 secondary-ntp: 0.0.0.0 poll-interval: 16s active-server: 10.0.0.199
Thanks ,
Of courseO.K
thanks .
and I can work normally ? I'm mean it won't interfere with anything else in the computer?