- NICT / 日本標準時
$ curl -s https://www.nict.go.jp/JST/JST5.html | awk '/<script[^>]*>/,/<\/script>/'
<script type="text/javascript">
<!--
var ServerList = [
"//3fe5a5f690efc790d4764f1c528a4ebb89fa4168.nict.go.jp/cgi-bin/json",
"//67495dde3b39c2991829589f0101ab7a035eecf5.nict.go.jp/cgi-bin/json",
"//08a08e3a6edef4ba7a0c055a42d8e1ba2597f2b5.nict.go.jp/cgi-bin/json" ];
var Text = {
error: "<h3>時刻情報取得状況: 失敗<\/h3>",
warning: "<h3>時刻情報取得状況: 不完全<\/h3>",
normal: "<h3>時刻情報取得状況: 良好<\/h3>",
incompat: "<h3>ご使用中のブラウザには対応していません。他のブラウザでご利用ください。<\/h3>",
correct: "合っています",
fast: " 秒 進んでいます",
slow: " 秒 遅れています" };
-->
</script>
<script type="text/javascript" src="json2.js"></script>
<script type="text/javascript" src="JST5.js"></script>
みたいな JSON があるのでこれを拾ってくると、
$ curl -s https://www.nict.go.jp/JST/JST5.html | sed -nE 's@.*"(https?:)?//([^"]*json)".*@\2@gp' | xargs curl -s
{
"id": "ntp-a1.nict.go.jp",
"it": 0.000,
"st": 1780625999.425,
"leap": 36,
"next": 1483228800,
"step": 1
}
{
"id": "ntp-a11.nict.go.jp",
"it": 0.000,
"st": 1780625999.574,
"leap": 36,
"next": 1483228800,
"step": 1
}
{
"id": "ntp-a12.nict.go.jp",
"it": 0.000,
"st": 1780625999.625,
"leap": 36,
"next": 1483228800,
"step": 1
}
みたいな感じなので、以下のようにすると、ローカルの現在時刻と比較できる。$ date "+%F %T.%3N"; curl -s https://www.nict.go.jp/JST/JST5.html | sed -nE 's@.*"(https?:)?//([^"]*json)".*@\2@gp' | xargs curl -s | jq .st | while read; do date -d@$REPLY "+%F %T.%3N"; done; date "+%F %T.%3N" 2026-06-05 11:24:29.603 2026-06-05 11:24:48.963 2026-06-05 11:24:49.113 2026-06-05 11:24:49.265 2026-06-05 11:24:30.482
HTTP HEAD Request に対する response の Date フィールドに http server の現在時刻があるので、
参照先の http server の時刻同期に問題がない前提であればこれも参考になる。
参照先の http server の時刻同期に問題がない前提であればこれも参考になる。
$ curl -I www.nict.go.jp HTTP/1.1 301 Moved Permanently Server: openresty Date: Fri, 05 Jun 2026 02:30:16 GMT Content-Type: text/html Content-Length: 1008 Connection: keep-alive Location: https://www.nict.go.jp/
$ date "+%F %T"; curl -Is www.nict.go.jp | sed -nE 's/^Date: *(.*)/\1/gp' | while read; do date -d "$REPLY" "+%F %T"; done; date "+%F %T" 2026-06-05 11:30:47 2026-06-05 11:30:47 2026-06-05 11:30:47
タグ

コメントをかく