JP2015059851A - Time correction device, time correction method, and computer program - Google Patents
Time correction device, time correction method, and computer program Download PDFInfo
- Publication number
- JP2015059851A JP2015059851A JP2013194179A JP2013194179A JP2015059851A JP 2015059851 A JP2015059851 A JP 2015059851A JP 2013194179 A JP2013194179 A JP 2013194179A JP 2013194179 A JP2013194179 A JP 2013194179A JP 2015059851 A JP2015059851 A JP 2015059851A
- Authority
- JP
- Japan
- Prior art keywords
- time
- unit
- correction
- leap
- check
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
Description
本発明は、コンピュータ・システムにおける時刻を補正する技術に関する。 The present invention relates to a technique for correcting time in a computer system.
コンピュータ・システムにおいて、内部に保持している時刻に後戻りが発生すると、動作に不具合を起こす可能性がある。したがって、このようなコンピュータ・システムでは、内部の時刻と実時刻とに差がある場合、時刻の後戻りが発生しないように補正するのが通常である。 In a computer system, if a backward movement occurs at the time stored in the computer system, it may cause a malfunction. Therefore, in such a computer system, when there is a difference between the internal time and the actual time, it is usually corrected so that the time does not return.
このような時刻の補正に、NTP(Network Time Protocol)を用いることがよく知られている。NTPでは、時刻を徐々に同期させるslewモードが用意されている。NTPクライアントは、slewモードを指定することにより、NTPサーバから通知される実時刻より内部の時刻が進んでいる場合でも、時刻を後戻りさせることなく補正することが可能である。 It is well known to use NTP (Network Time Protocol) for such time correction. In NTP, a slew mode for gradually synchronizing time is prepared. By specifying the slew mode, the NTP client can correct the time without going back even if the internal time is ahead of the actual time notified from the NTP server.
また、このような時刻の補正に関連する技術が、特許文献1に記載されている。この関連技術は、内部の時刻と実時刻との誤差に応じて、内部の時刻を計時するパルス信号の周期を可変とする。具体的には、この関連技術は、誤差がない場合、通常周期のパルスを発生する通常パルス発生器を選択して時刻装置に入力する。また、この関連技術は、内部の時刻が実時刻より遅れていれば、通常周期より短い(例えば1/2倍の)パルスを発生する遅れ補正用パルス発生器を選択して時刻装置に入力する。また、この関連技術は、内部の時刻が実時刻より進んでいれば、通常周期より長い(例えば2倍の)パルスを発生する進み補正用パルス発生器を選択して時刻装置に入力する。
A technique related to such time correction is described in
しかしながら、上述の関連技術には、以下の課題がある。 However, the related art described above has the following problems.
一般的に利用されているNTPの場合、slewモードにおける補正は、毎秒0.5ms(ミリ秒)ずつと定められている。したがって、例えば、内部の時刻と実時刻との間に1秒の誤差が生じている場合、NTPクライアントは、時刻の補正を完了させるまでに2000秒(33分20秒)を要する。例えば、内部の時刻と実時刻とに誤差がない状態で閏秒が発生したことを想定する。この場合、NTPクライアントは、閏秒による1秒の誤差が発生してから33分20秒間、実時刻との誤差を解消できない状態となる。 In the case of NTP generally used, the correction in the slew mode is set to 0.5 ms (millisecond) per second. Therefore, for example, when an error of 1 second occurs between the internal time and the actual time, the NTP client requires 2000 seconds (33 minutes and 20 seconds) to complete the time correction. For example, it is assumed that a leap second has occurred with no error between the internal time and the actual time. In this case, the NTP client is in a state where the error from the actual time cannot be resolved for 33 minutes and 20 seconds after an error of 1 second due to leap seconds occurs.
また、特許文献1に記載された関連技術は、内部の時刻が実時刻より進んでいる場合、通常の周期より長いパルスを時刻装置に入力するため、誤差の解消までに、誤差よりも長い時間を要する。例えば、進み補正用パルス発生器が、通常の2倍の周期のパルスを発生する場合、この関連技術は、1秒の進みを補正するまでに2秒の補正時間を要する。
Further, in the related art described in
このように、これらの関連技術では、時刻の補正に要する時間が長いという課題があった。 Thus, these related techniques have a problem that the time required for time correction is long.
本発明は、上述の課題を解決するためになされたもので、時刻の後戻りを発生させることなく、時刻の補正に要する時間をより短縮する技術を提供することを目的とする。 The present invention has been made to solve the above-described problems, and an object of the present invention is to provide a technique for further shortening the time required for time correction without causing a time return.
本発明の時刻補正装置は、基準時刻を計時する基準時計部と、装置時刻を計時する装置時計部と、時刻補正処理を行うか否かをチェックするよう設定されたチェック時刻になったことを検出するチェック時刻検出部と、前記チェック時刻に、前記基準時刻および前記装置時刻を比較し、前記装置時刻が前記基準時刻より遅れている場合、前記基準時刻を前記装置時計部に入力して前記装置時刻とし、前記装置時刻が前記基準時刻より進んでいる場合、前記基準時刻および前記装置時刻の差分の期間だけ、前記装置時計部による計時を停止させる時刻補正部と、を備える。 The time correction device according to the present invention has a reference clock unit for measuring the reference time, a device clock unit for measuring the device time, and a check time set to check whether or not to perform time correction processing. The check time detection unit to detect, the reference time and the device time are compared with the check time, and when the device time is delayed from the reference time, the reference time is input to the device clock unit A time correction unit configured to stop the time measurement by the device clock unit during a difference period between the reference time and the device time when the device time is ahead of the reference time.
また、本発明の時刻補正方法は、基準時刻を計時する基準時計部と、装置時刻を計時する装置時計部とを用いて、設定されたチェック時刻になると、前記基準時刻および前記装置時刻を比較し、前記装置時刻が前記基準時刻より遅れている場合、前記基準時刻を前記装置時計部に入力して前記装置時刻とし、前記装置時刻が前記基準時刻より進んでいる場合、前記基準時刻および前記装置時刻の差分の期間だけ、前記装置時計部による計時を停止させる。 In addition, the time correction method of the present invention compares the reference time and the device time when the set check time is reached by using the reference clock unit that measures the reference time and the device clock unit that measures the device time. When the device time is delayed from the reference time, the reference time is input to the device clock unit as the device time, and when the device time is ahead of the reference time, the reference time and the The time counting by the device clock unit is stopped only during the difference of the device time.
また、本発明のコンピュータ・プログラムは、基準時刻を計時する基準時計部と、装置時刻を計時する装置時計部とを用いて、時刻補正処理を行うか否かをチェックするよう設定されたチェック時刻になったことを検出するチェック時刻検出ステップと、前記チェック時刻に、前記基準時刻および前記装置時刻を比較し、前記装置時刻が前記基準時刻より遅れている場合、前記基準時刻を前記装置時計部に入力して前記装置時刻とし、前記装置時刻が前記基準時刻より進んでいる場合、前記基準時刻および前記装置時刻の差分の期間だけ、前記装置時計部による計時を停止させる時刻補正ステップと、をコンピュータ装置に実行させる。 Further, the computer program of the present invention uses a reference clock unit that counts the reference time and a device clock unit that counts the device time, so that a check time set to check whether or not to perform time correction processing is checked. A check time detecting step for detecting that the reference time and the device time are compared with the check time, and if the device time is delayed from the reference time, the reference time is set to the device clock unit. And the time correction step of stopping the time measurement by the device clock unit only during the period of difference between the reference time and the device time when the device time is ahead of the reference time. Cause the computer device to execute.
本発明は、時刻の後戻りを発生させることなく、時刻の補正に要する時間をより短縮する技術を提供することができる。 The present invention can provide a technique for further reducing the time required for correcting the time without causing a time return.
以下、本発明の実施の形態について、図面を参照して詳細に説明する。 Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings.
(第1の実施の形態)
本発明の第1の実施の形態としての時刻補正装置1の構成を図1に示す。図1において、時刻補正装置1は、基準時計部11と、装置時計部12と、チェック時刻検出部13と、時刻補正部14とを含む。
(First embodiment)
FIG. 1 shows a configuration of a
基準時計部11は、基準時刻を計時する。基準時刻とは、後述の装置時計部12における装置時刻を補正する際に基準となる時刻である。例えば、基準時計部11は、任意のタイミングで外部のNTPサーバから受信される時刻データに基づいて計時を行うことにより、基準時刻を表す情報を生成してもよい。また、基準時計部11は、図示しないパルス発生器から入力されるクロック信号により計時を行う。
The
装置時計部12は、自装置における時刻(装置時刻)を計時する。また、装置時計部12は、図示しないパルス発生器から入力されるクロック信号により計時を行う。
The
チェック時刻検出部13は、後述の時刻補正部14により次に時刻補正処理を実行する時刻(チェック時刻)を保持する。そして、チェック時刻検出部13は、基準時刻が、保持しているチェック時刻になったことを検出し、時刻補正部14に通知する。例えば、チェック時刻検出部13は、基準時計部11における基準時刻が、保持しているチェック時刻に等しくなると、時刻補正部14に、チェック時刻になったことを表す信号を送信するようにしてもよい。
The check
時刻補正部14は、チェック時刻になると、基準時刻および装置時刻を比較し、比較結果に基づき時刻補正処理を行うよう構成される。具体的には、時刻補正部14は、装置時刻が基準時刻より遅れている場合、基準時刻を、装置時計部12に入力して装置時刻とする。また、時刻補正部14は、装置時刻が基準時刻より進んでいる場合、基準時刻および装置時刻の差分の期間だけ、装置時計部12による計時を停止させる。
The
以上のように構成された時刻補正装置1の動作について、図2を参照して説明する。
The operation of the
図2では、まず、チェック時刻検出部13は、基準時刻がチェック時刻になると、時刻補正部14に対して信号を送出する(ステップS1でYes)。
In FIG. 2, first, the
次に、時刻補正部14は、基準時刻および装置時刻を比較する(ステップS2)。
Next, the
ここで、装置時刻が基準時刻より遅れている場合、時刻補正部14は、基準時刻を装置時計部12に入力し、装置時刻とする(ステップS3)。
Here, when the device time is delayed from the reference time, the
一方、装置時刻が基準時刻より進んでいる場合、時刻補正部14は、基準時刻および装置時刻の差分の期間だけ、装置時計部12による計時を停止させる(ステップS4)。
On the other hand, when the device time is ahead of the reference time, the
以上で、時刻補正装置1の動作の説明を終了する。
Above, description of operation | movement of the
次に、本発明の第1の実施の形態の効果について述べる。 Next, effects of the first exemplary embodiment of the present invention will be described.
本発明の第1の実施の形態としての時刻補正装置は、時刻の後戻りを発生させることなく、時刻の補正に要する時間をより短縮することができる。 The time correction apparatus as the first embodiment of the present invention can further reduce the time required for time correction without causing a time return.
その理由は、基準時計部が基準時刻を計時し、装置時計部が装置時刻を計時し、チェック時刻検出部が、基準時刻がチェック時刻になったことを検出すると、時刻補正部が、基準時刻および装置時刻を比較し、装置時刻が基準時刻より遅れている場合、基準時刻を装置時計部に入力して装置時刻とし、装置時刻が基準時刻より進んでいる場合、基準時刻および装置時刻の差分の期間だけ、装置時計部による計時を停止させるからである。 The reason is that when the reference clock unit measures the reference time, the device clock unit measures the device time, and when the check time detection unit detects that the reference time is the check time, the time correction unit If the device time is delayed from the reference time, the reference time is input to the device clock unit as the device time, and if the device time is ahead of the reference time, the difference between the reference time and the device time This is because the time counting by the device clock unit is stopped only during the period of time.
これにより、本実施の形態は、装置時刻が基準時刻より遅れている場合は、即時に装置時刻を基準時刻に補正することができる。また、本実施の形態は、装置時刻が基準時刻より進んでいる場合は、その差分期間で装置時刻を基準時刻に補正することができる。その結果、本実施の形態は、基準時刻および装置時刻の差分より長い時間を補正に要する前述の関連技術と比べて、補正に要する時間を大幅に短縮することができる。 Thereby, this embodiment can immediately correct the apparatus time to the reference time when the apparatus time is delayed from the reference time. Further, in the present embodiment, when the device time is ahead of the reference time, the device time can be corrected to the reference time in the difference period. As a result, the present embodiment can significantly reduce the time required for correction as compared to the above-described related art that requires a longer time than the difference between the reference time and the apparatus time.
(第2の実施の形態)
次に、本発明の第2の実施の形態について図面を参照して詳細に説明する。なお、本実施の形態の説明において参照する各図面において、本発明の第1の実施の形態と同一の構成および同様に動作するステップには同一の符号を付して本実施の形態における詳細な説明を省略する。
(Second Embodiment)
Next, a second embodiment of the present invention will be described in detail with reference to the drawings. Note that, in each drawing referred to in the description of the present embodiment, the same reference numerals are given to the same configuration and steps that operate in the same manner as in the first embodiment of the present invention, and the detailed description in the present embodiment. Description is omitted.
本発明の第2の実施の形態としての時刻補正装置2の構成を図3に示す。図3において、時刻補正装置2は、本発明の第1の実施の形態としての時刻補正装置1に対して、時刻補正部14に替えて時刻補正部24を備え、さらに、閏秒補正部25を備える点が異なる。
The structure of the
閏秒補正部25は、次のチェック時刻までに閏秒の発生予定があることを検出すると、その発生予定時刻を新たなチェック時刻として、チェック時刻検出部13に設定する。そして、閏秒補正部25は、基準時計部11から出力される基準時刻を、閏秒の発生予定内容に基づいて補正する。
When the leap second correcting
例えば、閏秒補正部25は、NTPサーバから受信される時刻データ(NTPパケット)に含まれるLI(Leap Indicator)ビットに基づいて、閏秒の挿入および削除のいずれかが発生するかを検出可能である。また、閏秒補正部25は、LIビットが設定されたNTPパケットの示す時刻に基づいて、閏秒の発生予定時刻を検出可能である。これは、閏秒の挿入または削除が、UTC(Coordinated Universal Time)における1日の最後の秒で発生することと、LIビットが24時間前から設定されることとによる。
For example, the leap
また、閏秒補正部25は、閏秒の挿入があることを検出した場合、基準時計部11から出力される基準時刻から1秒減算した値を、閏秒補正後の時刻として出力すればよい。また、閏秒補正部25は、閏秒の削除があることを検出した場合、基準時計部11から出力される基準時刻に対して1秒加算した値を、閏秒補正後の時刻として出力すればよい。
In addition, when the leap
なお、閏秒補正部25は、閏秒の発生予定を検出しない場合は、基準時計部11から出力される基準時刻をそのまま出力すればよい。
In addition, the leap
時刻補正部24は、本発明の第1の実施の形態における時刻補正部14と略同様に構成されるが、以下の2点が異なる。
The
時刻補正部24は、基準時刻および装置時刻の比較結果に基づいて動作する際に、基準時刻として、閏秒補正部25によって補正された基準時刻を用いる。
When the
また、時刻補正部24は、装置時計部12による計時の停止中に装置時計部12に対する装置時刻の読み出し要求があると、次のように動作するよう構成される。具体的には、時刻補正部24は、装置時計部12にその時点で保持されている装置時刻を所定単位だけ進めてから読み出し要求に応答させる。そして、時刻補正部24は、装置時計部12による計時の停止期間を、装置時計部12において装置時刻を進めたのと同じ長さだけ延長させる。
The
例えば、時刻補正部24は、図4に示すように構成されていてもよい。図4において、時刻補正部24は、比較器241と、タイマ入力セレクタ242と、タイマ243と、比較器244と、クロックセレクタ245と、装置時計部入力セレクタ246とを含む。なお、図4では、図面の都合上、時刻補正部24を示す破線の図形の内部に装置時計部12を示しているが、本発明の時刻補正部が装置時計部を含むことを必ずしも示すものではない。
For example, the
比較器241は、チェック時刻検出部13からチェック時刻の検出信号(enable信号)が入力されると、閏秒補正部25から出力される基準時刻および装置時計部12から出力される装置時刻を比較する。そして、比較器241は、装置時刻が基準時刻より遅れていることを表す遅れ信号または進んでいることを表す進み信号と、進んでいる場合の基準時刻および装置時刻の差分を表す信号とを出力する。なお、比較器241は、基準時刻および装置時刻が等しい場合には、これらの信号を出力しなければよい。
When the check time detection signal (enable signal) is input from the check
タイマ入力セレクタ242は、比較器241からの進み信号および差分信号、または、タイマ243のタイマ値に対する加算信号および減算信号を、タイマ243に入力する。
The
タイマ243は、比較器241からの差分信号の示す差分をタイマ値の初期値として、タイマ値が0となるまで減算を行う。また、タイマ243は、タイマ値を、比較器244に出力する。また、タイマ243は、タイマ値の減算中に装置時刻読み出し信号が入力されると、タイマ値を所定単位だけ加算する。図4では、装置時刻の動作周波数1KHzに対応する時刻の最小単位1msを所定単位として加算している。
The
比較器244は、タイマ値が0より大きい場合に、クロック停止信号をクロックセレクタ245に入力する。また、比較器244は、タイマ値が0より大きい場合に、タイマ243に、減算を続けることを示す減算信号(図4では、「−1ms(ミリ秒)」)を出力する。
The
クロックセレクタ245は、外部から入力されるクロック信号(図4では、1KHz(キロヘルツ))を、装置時計部入力セレクタ246を介して装置時計部12に出力する。これにより、装置時計部12は、装置時刻を1msずつ歩進して計時を行う。また、クロックセレクタ245は、比較器244からのクロック停止信号が入力されると、クロック信号を出力しない。これにより、装置時計部12は、装置時刻の計時を停止する。また、クロックセレクタ245は、クロック停止信号が入力されるときに、装置時刻読み出し信号が入力されると、クロック信号を1回分出力する。これにより、装置時計部12は、計時の停止中であっても、装置時刻読み出し要求に応じて、装置時刻を、時刻の最小単位(図4では1ms)だけ歩進する。
The
装置時計部入力セレクタ246は、比較器241からの遅れ信号が入力されると、閏秒補正部25からの基準時刻を、装置時計部12に対して出力する。これにより、装置時計部12の保持する装置時刻は、基準時刻と同一になる。
When the delay signal from the
以上のように構成された時刻補正装置2の動作について、図5〜図6を参照して説明する。
The operation of the
まず、時刻補正装置2の時刻補正処理を図5に示す。
First, the time correction process of the
図5では、まず、閏秒補正部25は、チェック時刻検出部13に設定されているチェック時刻までの間に、閏秒の発生予定があることを検出する(ステップS11でYes)。前述のように、閏秒補正部25は、外部から受信されるNTPパケットのLIビットに基づいて、閏秒の発生予定を検出してもよい。
In FIG. 5, first, the leap
次に、閏秒補正部25は、閏秒の発生予定時刻を新たなチェック時刻として、チェック時刻検出部13に設定する。また、閏秒補正部25は、閏秒の発生予定内容(挿入または削除)に基づいて、基準時計部11から出力される基準時刻に対する補正を行う(ステップS12)。前述のように、閏秒補正部25は、閏秒の挿入がある場合、基準時刻から1秒減算した値を出力し、閏秒の削除がある場合、基準時刻に対して1秒加算した値を出力すればよい。
Next, the leap
次に、チェック時刻検出部13は、閏秒補正部25から出力される基準時刻がチェック時刻になると、時刻補正部24に対してenable信号を送出する(ステップS13でYes)。
Next, when the reference time output from the leap
次に、時刻補正部24は、閏秒補正後の基準時刻および装置時刻を比較する(ステップS14)。
Next, the
具体的には、比較器241は、閏秒補正部25から出力される基準時刻および装置時計部12から出力される装置時刻を比較し、比較結果として、進み信号または遅れ信号と、進んでいる場合は差分信号とを出力する。なお、前述のように、比較器241は、基準時刻および装置時刻が等しい場合には、これらの信号を出力しない。
Specifically, the
ここで、装置時刻が、閏秒補正部25からの基準時刻より遅れている場合、時刻補正部24は、閏秒補正部25からの基準時刻を装置時計部12に入力し、装置時刻とする(ステップS15)。
Here, when the device time is delayed from the reference time from the leap
具体的には、比較器241から遅れ信号が出力されて装置時計部入力セレクタ246に入力されると、装置時計部入力セレクタ246は、閏秒補正部25からの基準時刻を、装置時計部12に対して出力する。
Specifically, when a delay signal is output from the
一方、装置時刻が、閏秒補正部25からの基準時刻より進んでいる場合、時刻補正部24は、閏秒補正部25からの基準時刻および装置時刻の差分の期間だけ、装置時計部12による計時を停止させる(ステップS16)。
On the other hand, when the device time is ahead of the reference time from the leap
具体的には、比較器241から進み信号および差分信号がタイマ入力セレクタ242を介してタイマ243に入力されると、タイマ243は、差分信号を初期値としてタイマ値が0になるまで減算を開始する。そして、比較器244は、タイマ値が0より大きい場合、クロック停止信号をクロックセレクタ245に出力し、装置時計部12へのクロックの供給を停止する。そして、タイマ243のタイマ値が0になると、比較器244は、クロック停止信号の出力を停止し、装置時計部12へのクロックの供給を開始させる。
Specifically, when the advance signal and the difference signal are input from the
以上で、時刻補正処理の説明を終了する。 Above, description of a time correction process is complete | finished.
次に、時刻補正装置2の装置時刻読み出し応答処理を図6に示す。
Next, device time read response processing of the
図6では、まず、時刻補正部24は、装置時刻の読み出し要求を受信する(ステップS21でYes)。
In FIG. 6, first, the
次に、時刻補正部24は、装置時計部12による計時を停止中である場合(ステップS22でYes)、装置時計部12に保持されている装置時刻を所定単位だけ進めるとともに、計時の停止期間を所定単位だけ延長する(ステップS23)。
Next, the
具体的には、タイマ243は、タイマ値が0より大きいときに装置時刻読み出し信号を受信すると、タイマ値を所定単位だけ加算する。ここで、タイマ243は、タイマ値を減算中であるため、減算を行うとともに加算を行うことになる。したがって、タイマ値は、プラスマイナス0となり変化しない。
Specifically, when the
そして、時刻補正装置2は、ステップS23で所定単位だけ進んだ装置時刻を応答すればよい。
And the
以上で、装置時刻読み出し応答処理の説明を終了する。 This is the end of the description of the apparatus time read response process.
次に、時刻補正装置2の動作を具体例で示す。ここでは、基準時計部11および装置時計部12の動作周波数は1KHzであるものとする。
Next, the operation of the
<閏秒の発生がなく、装置時刻が基準時刻より遅れている場合の動作例>
まず、閏秒の発生がなく、装置時刻が基準時刻より1秒遅れている場合の時刻補正装置2の動作について、図7を参照して説明する。なお、閏秒の発生が検出されないため、閏秒補正部25から出力される基準時刻は、基準時計部11が計時する補正前の基準時刻と同一である。
<Example of operation when there is no leap second and the device time is behind the reference time>
First, the operation of the
ここで、チェック時刻検出部13には、チェック時刻として、9時00分00秒000ms(以下、ミリ秒単位の数値を省略し、9:00:00と記載する)が設定されているものとする。
Here, the check
まず、基準時刻が9:00:00になると、チェック時刻検出部13は、比較器241へenable信号を出力する(ステップS13でYes)。
First, when the reference time reaches 9:00: 00, the check
次に、比較器241は、装置時刻(8:59:59)と基準時刻(9:00:00)とを比較し、遅れ信号を出力する(ステップS14で「遅れている」)。
Next, the
そして、装置時計部入力セレクタ246は、閏秒補正部25からの基準時刻を装置時計部12に出力し、装置時計部12は、基準時刻を装置時刻として計時を続ける(ステップS15)。
Then, the device clock
その結果、装置時計部12の装置時刻は、基準時計部11の基準時刻と同一となり、装置時計部12の遅れが補正される。
As a result, the device time of the
<閏秒の発生がなく、装置時刻が基準時刻より進んでいる場合の動作例>
次に、閏秒の発生がなく、装置時刻が基準時刻より2秒進んでいる場合の時刻補正装置2の動作について、図8を参照して説明する。なお、上述の具体例と同様に、閏秒の発生が検出されないため、閏秒補正部25から出力される基準時刻は、基準時計部11が計時する補正前の基準時刻と同一である。
<Example of operation when no leap second occurs and the device time is ahead of the reference time>
Next, the operation of the
また、上述の具体例と同様に、チェック時刻検出部13には、チェック時刻として、9:00:00が設定されているものとする。
Similarly to the above-described specific example, it is assumed that 9:00:00 is set as the check time in the check
まず、基準時刻が9:00:00になると、チェック時刻検出部13は、比較器241へenable信号を出力する(ステップS13でYes)。
First, when the reference time reaches 9:00: 00, the check
次に、比較器241は、装置時刻(9:00:02)と基準時刻(9:00:00)とを比較し、進み信号と、基準時刻および装置時刻の差分(2秒)を表す差分信号とを出力する(ステップS14で「進んでいる」)。
Next, the
そして、タイマ243は、差分(2秒)をタイマ値の初期値として1msの減算を開始する。また、比較器244は、タイマ243から出力されるタイマ値の値が0より大きい間、クロック停止信号を出力して、装置時計部12へのクロック信号の供給を停止する(ステップS16)。このため、装置時計部12は、1msずつの歩進を停止する。そして、比較器244は、タイマ243から出力されるタイマ値の値が0となった時点で、クロック停止信号の出力を停止し、装置時計部12へのクロック信号の供給を開始する。このため、装置時計部12は、1msずつの歩進を再開する。
Then, the
その結果、装置時計部12は、基準時刻に対して進んでいた2秒間だけ計時を停止することになり、進みが補正される。
As a result, the
<装置時計部12の計時停止中に装置時刻の読み出しに応答する場合の動作例>
次に、装置時計部12の計時停止中に装置時刻の読み出しがあった場合の動作について説明する。
<Operation example when responding to reading of device time while
Next, the operation when the device time is read while the
まず、クロックセレクタ245は、計時停止中(クロック停止信号の入力があるとき)に、装置時刻の読み出し信号を受け取ると、装置時計部12に対して1回分のクロックを供給する。これにより、装置時計部12は、装置時刻を1msだけ進める。
First, the
同時に、タイマ243は、タイマ値を1ms加算する。ここで、タイマ243は、タイマ値の減算(−1ms)を行っている。したがって、タイマ値は±0msとなり、タイマ値が0になるまでの期間が1ms延長される。
At the same time, the
このように、装置時計部12は、計時停止中でも、装置時刻の読み出しごとに、装置時刻を1msづつ更新するので、装置時刻の読み出しの順序性を保証する。また、タイマ243は、計時停止中の装置時刻の読み出しに応じて装置時刻が1ms更新されるごとに、タイマ期間を1msずつ延長するので、進みを補正する期間のつじつまがあうことになる。
As described above, the
<装置時刻および基準時刻の誤差がなく、閏秒の挿入予定がある場合の動作例>
次に閏秒の発生予定がある場合の動作について、図9を参照して説明する。
<Operation example when there is no error in device time and reference time and leap second insertion is planned>
Next, an operation in the case where a leap second is scheduled to occur will be described with reference to FIG.
まず、閏秒補正部25は、チェック時刻検出部13に設定されたチェック時刻までに、閏秒の挿入予定があることを検出する(ステップS11でYes)。閏秒の挿入時刻は、9:00:00の直前であるものとする。
First, the leap
そこで、閏秒補正部25は、チェック時刻検出部13に、新たなチェック時刻として、閏秒の挿入の発生直後の9:00:00を設定する。また、閏秒補正部25は、基準時計部11から出力される基準時刻に、1秒減算した値を出力する(ステップS12)。
Therefore, the leap
そして、閏秒補正部25から出力される基準時刻が9:00:00になると、チェック時刻検出部13は、比較器241へenable信号を出力する(ステップS13でYes)。
When the reference time output from the leap
次に、比較器241は、装置時刻(9:00:01)と、閏秒補正部25から出力される基準時刻(9:00:00)とを比較し、進み信号および差分信号(1秒)を出力する(ステップS14で「進んでいる」)。
Next, the
次に、タイマ243は、差分(1秒)をタイマ値として1msの減算を開始する。そして、前述の「閏秒の発生がなく、装置時刻が基準時刻より進んでいる場合の動作例」の場合と同様に動作することにより、装置時計部12は、1msずつの歩進を1秒間停止し、その後再開する(ステップS16)。
Next, the
その結果、時刻補正装置2は、実時刻と装置時刻との閏秒の挿入による誤差の補正を、閏秒発生直後に開始し、1秒間で補正を完了することができる。
As a result, the
以上で、具体例の説明を終了する。 This is the end of the description of the specific example.
次に、本発明の第2の実施の形態の効果について述べる。 Next, the effect of the second exemplary embodiment of the present invention will be described.
本発明の第2の実施の形態としての時刻補正装置は、時刻の後戻りを発生させることなく、閏秒の補正に要する時間をより短縮することができる。 The time correction apparatus according to the second embodiment of the present invention can further reduce the time required to correct leap seconds without causing a time return.
その理由は、閏秒補正部が、次のチェック時刻までに閏秒の発生予定があることを検出すると、その発生予定時刻を新たなチェック時刻としてチェック時刻検出部に設定し、基準時刻を閏秒の発生予定内容に基づいて補正し、時刻補正部が、閏秒補正後の基準時刻と装置時刻との比較に基づいて、装置時刻が閏秒補正後の基準時刻より遅れている場合、閏秒補正後の基準時刻を装置時計部に入力して装置時刻とし、装置時刻が閏秒補正後の基準時刻より進んでいる場合、閏秒補正後の基準時刻および装置時刻の差分の期間だけ、装置時計部による計時を停止させるからである。 The reason is that when the leap second correction unit detects that a leap second is scheduled to occur before the next check time, the leap second correction unit sets the expected occurrence time as a new check time in the check time detection unit and sets the reference time as If the device time is delayed from the reference time after the leap second correction based on the comparison between the reference time after the leap second correction and the device time, When the reference time after the second correction is input to the device clock unit as the device time and the device time is ahead of the reference time after the leap second correction, only the difference between the reference time after the leap second correction and the device time, This is because the timing by the device clock unit is stopped.
これにより、本実施の形態は、閏秒の発生直後に時刻の補正を開始し、閏秒の削除の場合には、即時に、装置時刻を閏秒補正後の基準時刻に補正することができる。また、本実施の形態は、閏秒の発生直後に時刻の補正を開始し、閏秒の挿入の場合には、挿入された閏秒の期間(1秒間)で、装置時刻を、閏秒補正後の基準時刻に補正することができる。 Thereby, the present embodiment starts time correction immediately after the occurrence of leap seconds, and in the case of deletion of leap seconds, the apparatus time can be immediately corrected to the reference time after leap second correction. . In the present embodiment, time correction is started immediately after the occurrence of leap seconds. When leap seconds are inserted, the apparatus time is corrected for leap seconds in the inserted leap second period (1 second). It can be corrected to a later reference time.
また、本実施の形態は、装置時刻の進みの補正のために装置時計部の計時を停止させながらも、自装置から読み出される装置時刻の順序性を保証することができる。 In addition, the present embodiment can guarantee the order of the device times read from the own device while stopping the time measurement of the device clock unit to correct the advance of the device time.
その理由は、時刻補正部が、装置時刻の進みによる装置時計部の停止中に装置時刻の読み出し要求があると、装置時計部に保持される装置時刻を所定単位だけ進めてから読み出し要求に応答させるとともに、装置時計部の計時停止期間を所定単位だけ延長させるからである。 The reason for this is that if the time correction unit makes a request to read the device time while the device clock is stopped due to the advance of the device time, the device time held by the device clock is advanced by a predetermined unit and then responds to the read request. This is because the timing stop period of the device clock section is extended by a predetermined unit.
これにより、本実施の形態は、装置時刻の進みの補正のために装置時計部が計時を停止中であっても、装置時刻の読み出しがあるごとに、装置時刻を所定単位づつ更新する。したがって、本実施の形態は、読み出される装置時刻の順序性を保証する。このとき、本実施の形態は、計時停止中の装置時刻の読み出しに応じて装置時刻が所定単位ずつ更新される度に、計時停止期間を所定単位だけ延長するので、装置時刻の進みを問題なく補正できる。 As a result, in the present embodiment, the device time is updated by a predetermined unit every time the device time is read out even when the device clock unit stops counting time to correct the advance of the device time. Therefore, this embodiment guarantees the order of the device times to be read. At this time, in this embodiment, every time the device time is updated by a predetermined unit in response to the reading of the device time during the time stop, the time stop period is extended by a predetermined unit, so that the advancement of the device time can be performed without any problem. Can be corrected.
なお、本実施の形態において、基準時計部および装置時計部の動作周波数を1KHzとする例を中心に説明したが、これらの時計部の動作周波数を限定するものではない。また、計時停止中に装置時刻の読み出しがあった場合に装置時刻を進める単位を1msとする例を中心に説明したが、装置時刻を進める所定単位を限定するものではない。 In the present embodiment, the description has been made centering on an example in which the operating frequency of the reference clock unit and the device clock unit is 1 KHz, but the operating frequency of these clock units is not limited. In addition, although an example in which the unit for advancing the apparatus time is 1 ms when the apparatus time is read while the time is stopped has been described, the predetermined unit for advancing the apparatus time is not limited.
また、本実施の形態において、閏秒補正部が、NTPパケットに基づいて閏秒の発生予定を検出する例について説明したが、NTPパケットに限らず、その他の公知の技術により閏秒の発生予定を検出してもよい。 In the present embodiment, the leap second correction unit has described an example in which the leap second occurrence schedule is detected based on the NTP packet. However, the leap second occurrence schedule is not limited to the NTP packet, and other known techniques are used. May be detected.
また、上述した本発明の各実施の形態において、基準時計部が、NTPサーバから受信される時刻データに基づいて基準時刻を計時する例について説明したが、NTPサーバに限らず、その他の公知の技術により取得可能な時刻に基づいて基準時刻を計時してもよい。 In each of the embodiments of the present invention described above, an example in which the reference clock unit measures the reference time based on time data received from the NTP server has been described. The reference time may be measured based on the time that can be acquired by technology.
また、上述した本発明の各実施の形態において、時刻補正装置の各機能ブロックが、ハードウェア要素により構成される例を中心に説明したが、各機能ブロックの一部、全部、または、それらの組み合わせは、メモリに記憶されたコンピュータ・プログラムを実行するプロセッサにより実現されていてもよい。 Further, in each of the embodiments of the present invention described above, each functional block of the time correction apparatus has been described mainly with respect to examples configured by hardware elements. However, a part, all, or part of each functional block is described. The combination may be realized by a processor that executes a computer program stored in a memory.
また、上述した本発明の各実施の形態において、各フローチャートを参照して説明した時刻補正装置の動作を、本発明のコンピュータ・プログラムとしてコンピュータ装置の記憶装置(記憶媒体)に格納しておき、係るコンピュータ・プログラムを当該CPUが読み出して実行するようにしてもよい。そして、このような場合において、本発明は、係るコンピュータ・プログラムのコードあるいは記憶媒体によって構成される。 In each of the embodiments of the present invention described above, the operation of the time correction apparatus described with reference to each flowchart is stored in a storage device (storage medium) of the computer apparatus as a computer program of the present invention. Such a computer program may be read and executed by the CPU. In such a case, the present invention is constituted by the code of the computer program or a storage medium.
また、上述した各実施の形態は、適宜組み合わせて実施されることが可能である。 Moreover, each embodiment mentioned above can be implemented in combination as appropriate.
また、本発明は、上述した各実施の形態に限定されず、様々な態様で実施されることが可能である。 The present invention is not limited to the above-described embodiments, and can be implemented in various modes.
1、2 時刻補正装置
11 基準時計部
12 装置時計部
13 チェック時刻検出部
14、24 時刻補正部
25 閏秒補正部
241 比較器
242 タイマ入力セレクタ
243 タイマ
244 比較器
245 クロックセレクタ
246 装置時計部入力セレクタ
1, 2
Claims (9)
装置時刻を計時する装置時計部と、
時刻補正処理を行うか否かをチェックするよう設定されたチェック時刻になったことを検出するチェック時刻検出部と、
前記チェック時刻に、前記基準時刻および前記装置時刻を比較し、前記装置時刻が前記基準時刻より遅れている場合、前記基準時刻を前記装置時計部に入力して前記装置時刻とし、前記装置時刻が前記基準時刻より進んでいる場合、前記基準時刻および前記装置時刻の差分の期間だけ、前記装置時計部による計時を停止させる時刻補正部と、
を備えた時刻補正装置。 A reference clock for measuring the reference time,
A device clock for measuring device time;
A check time detection unit that detects that a check time set to check whether or not to perform time correction processing is reached;
The reference time and the device time are compared with the check time, and when the device time is delayed from the reference time, the reference time is input to the device clock unit as the device time, and the device time is A time correction unit that stops time counting by the device clock unit for a period of difference between the reference time and the device time when the time is ahead of the reference time;
A time correction apparatus comprising:
前記時刻補正部は、前記基準時刻として、前記閏秒補正部によって補正された基準時刻を用いることを特徴とする請求項1に記載の時刻補正装置。 When it is detected that there is a leap second occurrence schedule by the next check time, the occurrence time is set as a new check time in the check time detection unit, and based on the leap second occurrence schedule content, A leap second correction unit that corrects the reference time is further provided.
The time correction device according to claim 1, wherein the time correction unit uses the reference time corrected by the leap second correction unit as the reference time.
設定されたチェック時刻になると、前記基準時刻および前記装置時刻を比較し、前記装置時刻が前記基準時刻より遅れている場合、前記基準時刻を前記装置時計部に入力して前記装置時刻とし、前記装置時刻が前記基準時刻より進んでいる場合、前記基準時刻および前記装置時刻の差分の期間だけ、前記装置時計部による計時を停止させる、時刻補正方法。 Using a reference clock unit that measures the reference time and a device clock unit that measures the device time,
When the set check time is reached, the reference time and the device time are compared, and if the device time is behind the reference time, the reference time is input to the device clock unit as the device time, A time correction method in which, when the device time is ahead of the reference time, the time measurement by the device clock unit is stopped only during a difference between the reference time and the device time.
前記閏秒の発生予定内容に基づいて、前記基準時刻を補正し、
前記チェック時刻になると行う処理において、前記基準時刻として、前記閏秒の発生予定内容に基づいて補正された基準時刻を用いることを特徴とする請求項4に記載の時刻補正方法。 When it is detected that there is a leap second occurrence by the next check time, the occurrence occurrence time is set as a new check time,
Correct the reference time based on the planned occurrence of leap seconds,
5. The time correction method according to claim 4, wherein a reference time corrected on the basis of the planned content of the leap second is used as the reference time in the processing performed when the check time is reached.
時刻補正処理を行うか否かをチェックするよう設定されたチェック時刻になったことを検出するチェック時刻検出ステップと、
前記チェック時刻に、前記基準時刻および前記装置時刻を比較し、前記装置時刻が前記基準時刻より遅れている場合、前記基準時刻を前記装置時計部に入力して前記装置時刻とし、前記装置時刻が前記基準時刻より進んでいる場合、前記基準時刻および前記装置時刻の差分の期間だけ、前記装置時計部による計時を停止させる時刻補正ステップと、
をコンピュータ装置に実行させるコンピュータ・プログラム。 Using a reference clock unit that measures the reference time and a device clock unit that measures the device time,
A check time detection step for detecting that a check time set to check whether or not to perform time correction processing is reached;
The reference time and the device time are compared with the check time, and when the device time is delayed from the reference time, the reference time is input to the device clock unit as the device time, and the device time is If the time is ahead of the reference time, a time correction step of stopping the time measurement by the device clock unit only for the difference between the reference time and the device time; and
Is a computer program that causes a computer device to execute.
前記時刻補正ステップにおいて、前記基準時刻として、前記閏秒の発生予定内容に基づいて補正された基準時刻を用いることを特徴とする請求項7に記載のコンピュータ・プログラム。 When it is detected that a leap second is scheduled to occur before the next check time, the occurrence time is set as a new check time, and the reference time is corrected based on the details of the leap second occurrence. Further causing the computer device to execute a second correction step;
The computer program according to claim 7, wherein, in the time correction step, a reference time corrected based on the planned leap second content is used as the reference time.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013194179A JP2015059851A (en) | 2013-09-19 | 2013-09-19 | Time correction device, time correction method, and computer program |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2013194179A JP2015059851A (en) | 2013-09-19 | 2013-09-19 | Time correction device, time correction method, and computer program |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2015059851A true JP2015059851A (en) | 2015-03-30 |
Family
ID=52817497
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2013194179A Pending JP2015059851A (en) | 2013-09-19 | 2013-09-19 | Time correction device, time correction method, and computer program |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2015059851A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2018112425A (en) * | 2017-01-10 | 2018-07-19 | 株式会社デンソーテン | Method for system time synchronization |
KR20210125083A (en) | 2019-03-20 | 2021-10-15 | 엔이씨 플랫폼즈 가부시키가이샤 | Broadcast control apparatus, broadcast control method, program, and recording medium |
-
2013
- 2013-09-19 JP JP2013194179A patent/JP2015059851A/en active Pending
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2018112425A (en) * | 2017-01-10 | 2018-07-19 | 株式会社デンソーテン | Method for system time synchronization |
KR20210125083A (en) | 2019-03-20 | 2021-10-15 | 엔이씨 플랫폼즈 가부시키가이샤 | Broadcast control apparatus, broadcast control method, program, and recording medium |
US11778128B2 (en) | 2019-03-20 | 2023-10-03 | Nec Platforms, Ltd. | Broadcasting control apparatus, broadcasting control method, program, and recording medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10892840B2 (en) | Method and apparatus for TDMA slot synchronization and calibration of master and slave | |
EP2369438B1 (en) | Calibration method of a real time clock signal | |
US8392730B2 (en) | Current sharing method of DC power supply and device thereof | |
US20140355629A1 (en) | Communication apparatus, communication system, and communication method | |
US9871609B2 (en) | Network system, time master station, and time slave station | |
US9600023B2 (en) | Method and data processing unit for providing a timestamp | |
US20200382233A1 (en) | Information processing apparatus and time synchronization method | |
JP2015059851A (en) | Time correction device, time correction method, and computer program | |
JP5143952B2 (en) | Wireless base station | |
US10222786B2 (en) | Numerical control system having synchronous control function between units | |
KR101290785B1 (en) | Apparatus and method for clock synchronization in distributed control system | |
JP2012128552A (en) | Information processing apparatus and time synchronizing method of information processing apparatus | |
CA3014595C (en) | Method and apparatus for tdma slot synchronization and calibration of master and slave | |
JP4616054B2 (en) | Measuring system | |
JP2017005379A (en) | Communication device, communication system, estimation method and program | |
JP6227196B2 (en) | Clock diagnostic device and clock diagnostic method | |
JP4230808B2 (en) | Time synchronization method and communication system | |
CN112019288B (en) | Time synchronization method, service single board and network equipment | |
JP2004272403A (en) | Process input/output device and monitor control system using the same | |
WO2024001423A1 (en) | Method and apparatus for determining dimensional measurement time, and devices | |
KR102497256B1 (en) | System and method for timing synchronization of task execution in multi-core environment | |
RU2511596C2 (en) | Time synchronisation in automated devices | |
JP2020107959A (en) | Communication system | |
JP5821807B2 (en) | Time correction device | |
KR100762178B1 (en) | Timer error correcting method of display apparatus |