Skip to content

Commit

Permalink
V2.56: system time could go back to 1969 before sync with RTC
Browse files Browse the repository at this point in the history
System time will go back to 1970 without RTC and fake-hwclock. By
having the timezone considered, it could actually go back to 1969.12.31.
  • Loading branch information
uugear committed Sep 15, 2017
1 parent 2f76abb commit 158de83
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion wittyPi/daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cur_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# utilities
. "$cur_dir/utilities.sh"

log 'Witty Pi 2 daemon (v2.55) is started.'
log 'Witty Pi daemon (v2.56) is started.'

# halt by GPIO-4 (BCM naming)
halt_pin=4
Expand Down
2 changes: 1 addition & 1 deletion wittyPi/runScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ schedule_file="$cur_dir/schedule.wpi"
. "$cur_dir/utilities.sh"

# pending until system time gets initialized
while [[ "$(date +%Y)" == *"1970"* ]]; do
while [[ "$(date +%Y)" == *"1969"* ]] || [[ "$(date +%Y)" == *"1970"* ]]; do
sleep 1
done

Expand Down
2 changes: 1 addition & 1 deletion wittyPi/syncTime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ else
if [[ $rtctime == *"1999"* ]] || [[ $rtctime == *"2000"* ]]; then
# if you never set RTC time before
log 'RTC time has not been set before (stays in year 1999/2000).'
if [[ $sysyear != *"1970"* ]]; then
if [[ $sysyear != *"1969"* ]] && [[ $sysyear != *"1970"* ]]; then
# your Raspberry Pi has a decent time
system_to_rtc
else
Expand Down
4 changes: 2 additions & 2 deletions wittyPi/wittyPi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ fi

echo '================================================================================'
echo '| |'
echo '| Witty Pi 2 - Realtime Clock + Power Management for Raspberry Pi |'
echo '| Witty Pi - Realtime Clock + Power Management for Raspberry Pi |'
echo '| |'
echo '| < Version 2.55 > by UUGear s.r.o. |'
echo '| < Version 2.56 > by UUGear s.r.o. |'
echo '| |'
echo '================================================================================'

Expand Down

0 comments on commit 158de83

Please sign in to comment.