Skip to content

Commit

Permalink
webui: ntp offsets from tzdata/etcetera
Browse files Browse the repository at this point in the history
refer to our docs for the script output
see #2548
  • Loading branch information
mcspr committed Nov 16, 2022
1 parent fcbc57c commit 70d25ae
Show file tree
Hide file tree
Showing 22 changed files with 11,966 additions and 11,815 deletions.
Binary file modified code/espurna/data/index.all.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.curtain.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.garland.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.light.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.lightfox.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.rfbridge.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.rfm69.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.sensor.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.small.html.gz
Binary file not shown.
Binary file modified code/espurna/data/index.thermostat.html.gz
Binary file not shown.
2,028 changes: 1,018 additions & 1,010 deletions code/espurna/static/index.all.html.gz.h

Large diffs are not rendered by default.

2,853 changes: 1,430 additions & 1,423 deletions code/espurna/static/index.curtain.html.gz.h

Large diffs are not rendered by default.

2,790 changes: 1,399 additions & 1,391 deletions code/espurna/static/index.garland.html.gz.h

Large diffs are not rendered by default.

1,460 changes: 734 additions & 726 deletions code/espurna/static/index.light.html.gz.h

Large diffs are not rendered by default.

2,799 changes: 1,403 additions & 1,396 deletions code/espurna/static/index.lightfox.html.gz.h

Large diffs are not rendered by default.

2,862 changes: 1,435 additions & 1,427 deletions code/espurna/static/index.rfbridge.html.gz.h

Large diffs are not rendered by default.

2,871 changes: 1,439 additions & 1,432 deletions code/espurna/static/index.rfm69.html.gz.h

Large diffs are not rendered by default.

439 changes: 224 additions & 215 deletions code/espurna/static/index.sensor.html.gz.h

Large diffs are not rendered by default.

2,761 changes: 1,384 additions & 1,377 deletions code/espurna/static/index.small.html.gz.h

Large diffs are not rendered by default.

2,837 changes: 1,422 additions & 1,415 deletions code/espurna/static/index.thermostat.html.gz.h

Large diffs are not rendered by default.

35 changes: 32 additions & 3 deletions code/html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1271,9 +1271,38 @@ <h2>Synchronize device time with a remote server</h2>

<div class="pure-control-group">
<label>Time Zone</label>
<input name="ntpTZ" type="text">
<span class="pure-form-message-inline">POSIX TZ variable, defaults to <code>UTC0</code>. For the list of possible values, <a class="external" href="https://github.com/esp8266/Arduino/blob/master/cores/esp8266/TZ.h">see esp8266/Arduino's TZ.h (use the value inside of quotes)</a>.</span>
<span class="pure-form-message-inline">For the complete documentation, <a class="external" href="https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html">see libc tzset(3) manual page</a></span>
<input name="ntpTZ" type="text" list="list:ntpTZ">
<span class="pure-form-message-inline">POSIX TZ variable, defaults to <code>UTC0</code> aka "No offset". Notice that <code>-2</code> means "UTC plus 2 hours", and <code>+2</code> - "UTC minus 2 hours". For the list of possible values, <a class="external" href="https://github.com/xoseperez/espurna/wiki/NTP#tz-variable">see our wiki entry.</a></span>
<span class="pure-form-message-inline">For the technical documentation, <a class="external" href="https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html">see libc tzset(3) manual page</a></span>
<datalist id="list:ntpTZ">
<option value="UTC0">No offset</option>
<option value="UTC-14"></option>
<option value="UTC-13"></option>
<option value="UTC-12"></option>
<option value="UTC-11"></option>
<option value="UTC-10"></option>
<option value="UTC-9"></option>
<option value="UTC-8"></option>
<option value="UTC-7"></option>
<option value="UTC-6"></option>
<option value="UTC-5"></option>
<option value="UTC-4"></option>
<option value="UTC-3"></option>
<option value="UTC-2"></option>
<option value="UTC-1"></option>
<option value="UTC+1"></option>
<option value="UTC+2"></option>
<option value="UTC+3"></option>
<option value="UTC+4"></option>
<option value="UTC+5"></option>
<option value="UTC+6"></option>
<option value="UTC+7"></option>
<option value="UTC+8"></option>
<option value="UTC+9"></option>
<option value="UTC+10"></option>
<option value="UTC+11"></option>
<option value="UTC+12"></option>
</datalist>
</div>

</fieldset>
Expand Down
46 changes: 46 additions & 0 deletions code/scripts/tzdata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import argparse
import mmap
import os
import pytz
import sys

def zones(root):
out = []

for zone in pytz.all_timezones_set:
with open(os.path.join(root, zone), "rb") as f:
magic = f.read(4)
if magic != b"TZif":
continue

m = mmap.mmap(f.fileno(), 0, prot=mmap.PROT_READ)
newline = m.rfind(b'\n', 0, len(m) - 1)
if newline < 0:
continue

m.seek(newline + 1)
tz = m.readline().strip()

out.append([zone, tz.decode("ascii")])

out.sort(key=lambda x: x[0])
return out

def table(zones):
print("|Name|Value|")
print("|---|---|")
for name, value in zones:
print(f"|{name}|{value}|")

print()
print(f"*{pytz.OLSON_VERSION=}*")
print(f"*{pytz.VERSION=}*")

if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--root",
help="Where do we get raw zoneinfo files from",
default=os.path.join(os.path.dirname(pytz.__file__), "zoneinfo"))
args = parser.parse_args()

table(zones(args.root))

0 comments on commit 70d25ae

Please sign in to comment.