mirror of
https://github.com/esp8266/Arduino.git
synced 2025-08-31 22:22:34 +03:00
time: import IANA timezone definitions, expose SNTP API (#6373)
* time: import IANA timezone definitions - `configTime("timezone", "ntp servers...")` added - timezone definitions by country/cities (TZ.h) - script to update timezone definitions - updated example * fix former configTime non-matching signature * +include * example: add scheduled function in callback * crlf fix * +missing license for napt * SNTP: expose configuration helpers * update submodule * update precompiled libraries * optional: change SNTP startup delay * makes SNTP_UPDATE_DELAY a weak function update example fix for lwip1.4 * on the proper use of polledTimeout api... thanks @mcspr :] * improve update script (per review) * update lwIP submodule * update submodule * hide harmless shell message * update the release process by asking first to update TZ.h [ci skip] * minor update in release documentation * update in release documentation * update in release documentation * clarify release documentation * fix release documentation - sorry for the noise :( * fixes per review * example style * useless variable in example * update lwip2 submodule reference, to include espressif missing declaration fixes
This commit is contained in:
71
tools/TZupdate.sh
Executable file
71
tools/TZupdate.sh
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/sh
|
||||
|
||||
# this shell script refreshes world timezone definitions in
|
||||
# cores/esp8266/TZ.h
|
||||
#
|
||||
# to run it, use:
|
||||
# /path/to/TZupdate.sh
|
||||
# tools/TZupdate.sh
|
||||
# ./TZupdate.sh
|
||||
|
||||
dir=$(cd ${0%/*} 2>/dev/null; pwd)
|
||||
base=${0##*/}
|
||||
|
||||
csv=https://raw.githubusercontent.com/nayarsystems/posix_tz_db/master/zones.csv
|
||||
|
||||
set -e
|
||||
|
||||
tz_tmpdir=$(mktemp -d)
|
||||
trap 'rm -r $tz_tmpdir' EXIT
|
||||
|
||||
input=$tz_tmpdir/zones.csv
|
||||
names=$tz_tmpdir/names.txt
|
||||
values=$tz_tmpdir/values.txt
|
||||
|
||||
wget -O $input $csv || curl $csv > $input
|
||||
|
||||
sed -e 's/^[^,]*,//g' -e 's,^,PSTR(,g' -e 's,$,),g' < $input > $values
|
||||
sed -e 's/^\([^,]*\),.*/#define TZ_\1/g' -e 's,["],,g' < $input | tr '/\-+' '_mp' > $names
|
||||
|
||||
(
|
||||
|
||||
cat << EOF
|
||||
|
||||
// autogenerated from $csv
|
||||
// by script <esp8266 arduino core>/tools/${base}
|
||||
// $(date -u)
|
||||
//
|
||||
// This database is autogenerated from IANA timezone database
|
||||
// https://www.iana.org/time-zones
|
||||
// and can be updated on demand in this repository
|
||||
// or by yourself using the above script
|
||||
|
||||
#ifndef TZDB_H
|
||||
#define TZDB_H
|
||||
|
||||
EOF
|
||||
|
||||
paste $names $values
|
||||
|
||||
cat << EOF
|
||||
|
||||
#endif // TZDB_H
|
||||
EOF
|
||||
|
||||
) > $tz_tmpdir/TZ.h
|
||||
|
||||
backup=$(date +%s)
|
||||
mv ${dir}/../cores/esp8266/TZ.h ${dir}/../cores/esp8266/TZ.h.$backup
|
||||
mv $tz_tmpdir/TZ.h ${dir}/../cores/esp8266/TZ.h
|
||||
|
||||
cat << EOF
|
||||
|
||||
Done:
|
||||
'${dir}/../cores/esp8266/TZ.h' is updated
|
||||
|
||||
Diff:
|
||||
----8<-------8<------8<---
|
||||
$(diff -u ${dir}/../cores/esp8266/TZ.h.$backup ${dir}/../cores/esp8266/TZ.h)
|
||||
--->8----->8------>8------
|
||||
|
||||
EOF
|
Reference in New Issue
Block a user