Tiny Core Base > TCB Bugs

TC9.0 /etc/init.d/settime.sh broken

(1/4) > >>

y_satou70:
Just found this issue while I replace my box's coin battery on motherboard....
/etc/init.d/settime.sh is failed to set time due to following code:


--- Code: ---        XXX=$(/bin/date -I)
        XXX=${XXX:0:4}

        if [ "$XXX" -ge "2015" ];
        then
            break
        fi

--- End code ---

not sure why this logic is implemented here, but due to this code, this script do nothing since 2015...

I checked both x86 and x86_64, both distribution core.gz / corepure64.gz has this bug.

Greg Erskine:
hi y_satou70,

I "think" if the code was really broken someone would have noticed by now.  ;)

My "guess" is it is testing that the time is not epoch therefore the time has been set by a rtc. If time set by rtc then don't run ntp. The year 2015 was probably chosen as it was the year the fix was added. ???

regards
Greg

curaga:
Yes, the logic works if your board was manufactured before 2015 and so sets its date to an epoch before that. Updating to 2018.

y_satou70:
oh wait, does it mean if system board 's clock has any timestamp 2018 then it does not do any set clock action ?
I think if boot option has "ntpserver=...." entry, it should pull current time from ntpserver and set it at booting regardless what time currently system board has.
And if it's expected that the time is set from RTC and that's good enough, then that system just need to omit "ntpserver=...." entry on boot option.

curaga:
Yes. The current edition of settime.sh was written by Bela for rpi boards, which do not have a RTC. It also works for boards whose battery has run out.

Would you like to send a patch?

Navigation

[0] Message Index

[#] Next page

Go to full version