<p>An ugly hack that may work is to scan files in /etc/* on boot, or wherever relevant, and extract the most recent modification date. Then set local time to that datetime, if local time is older. This would depend on just how large of a time offset olsrd-mod-mdp will tolerate.</p>
<p>Here is /etc/rc.local with said ugly hack, in use on TP-Link TL-MR3020's, which don't preserve local time across reboot. You would likely want to add an if statement first verifying whether the local time is indeed older.</p>
<pre><code># Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
# Get date/time components of most recent filemod under /etc/update
FILELISTING=`ls -lr -u -e /etc/ | tail -1`
[ -n "${FILELISTING}" ] && {
FILEMOD_YYYY=`echo $FILELISTING | awk '{printf "%d", $10}'`
FILEMOD_HHMMSS=`echo $FILELISTING | awk '{printf "%s", $9}'`
FILEMOD_DD=`echo $FILELISTING | awk '{printf "%s", $8}'`
FILEMOD_MONTH=`echo $FILELISTING | awk '{printf "%s", $7}'`
# Convert Month to numerical MM format
case "${FILEMOD_MONTH}" in
"Jan") FILEMOD_MM="01" ;;
"Feb") FILEMOD_MM="02" ;;
"Mar") FILEMOD_MM="03" ;;
"Apr") FILEMOD_MM="04" ;;
"May") FILEMOD_MM="05" ;;
"Jun") FILEMOD_MM="06" ;;
"Jul") FILEMOD_MM="07" ;;
"Aug") FILEMOD_MM="08" ;;
"Sep") FILEMOD_MM="09" ;;
"Oct") FILEMOD_MM="10" ;;
"Nov") FILEMOD_MM="11" ;;
"Dec") FILEMOD_MM="12" ;;
*) FILEMOD_MM="01" ;;
esac
# Set local date/time, assuming format "YYYY-MM-DD hh:mm:ss"
DATE="${FILEMOD_YYYY}-${FILEMOD_MM}-${FILEMOD_DD} $FILEMOD_HHMMSS"
date -s "${DATE}"
}
</code></pre>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href='https://github.com/opentechinstitute/olsrd/issues/9#issuecomment-26517343'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/HSS0tS4nfORw_XnPQF8f0Wub0dHctHm25KowpGMeq8-nIjPWt6LMAnKdYbso0WC6.gif' height='1' width='1'></p>