Peter H. Jin
||2 months ago|
|priv||3 years ago|
|.gitignore||2 years ago|
|.gitlab-ci.yml||3 years ago|
|DST.java||2 years ago|
|IERSBulletinReader.java||3 years ago|
|README.md||2 years ago|
|clock.css||2 months ago|
|clock.js||2 months ago|
|cloud-function.js||2 years ago|
|csp.js||2 months ago|
|demo.js||2 months ago|
|favicon.ico||2 years ago|
|iers.js||2 months ago|
|index.html||2 months ago|
|make_demo.sh||2 months ago|
|nginx.conf||2 years ago|
|online-demo.md||2 years ago|
|tzselector.js||2 months ago|
Web clock for nginx, ideal for NTP servers.
This project was inspired by the USNO Master Clock and a number of other web clocks, such as
- time.gov (NIST web clock)
- PTB Web Clock
- NICT/JST Clock
- Paris Observatory/SYRTE Web Clock
- NRC Web Clock
The clock displays time in local time, Coordinated Universal Time (UTC) and
all half-hour time zone offsets from -12 to +14.
Support for other time zones and daylight saving time is planned.
UPDATE: Daylight saving time is now supported.
How to self-host
You will need a computer (VPS, physical computer, or something else) running the nginx web server.
- Copy the
iers.jsfiles to anywhere in the webserver's file-serving location.
- Look for the
location /_insvc/timeblock in the
nginx.conffile here and copy the entire block to your
- If you would like to use a different location instead of
/_insvc/time, you can update the top of
clock.jsto do so.
To enable leap second warnings, compile and run
using Java 8 or later and write its output to a file named
located in the same directory as the
In order for the clock to display Daylight Saving Time information, you will
need to create a file called
Compile and run
DST.java and write the program output to
the same directory as the
Pre-built versions of both files are available at
- Time zone selector
- Leap second warnings (via IERS bulletin parsing)
- Use multiple endpoint requests and average them out
- Daylight saving time/summer time in time zone selector
License (2-clause BSD)
Copyright 2018-2019 Peter H. Jin All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.