Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP6951019B2 - Counter device, time calculation device, information processing device, control method, time calculation method and program - Google Patents
[go: Go Back, main page]

JP6951019B2 - Counter device, time calculation device, information processing device, control method, time calculation method and program - Google Patents

Counter device, time calculation device, information processing device, control method, time calculation method and program Download PDF

Info

Publication number
JP6951019B2
JP6951019B2 JP2019044609A JP2019044609A JP6951019B2 JP 6951019 B2 JP6951019 B2 JP 6951019B2 JP 2019044609 A JP2019044609 A JP 2019044609A JP 2019044609 A JP2019044609 A JP 2019044609A JP 6951019 B2 JP6951019 B2 JP 6951019B2
Authority
JP
Japan
Prior art keywords
counter
count value
time
conversion coefficient
value
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.)
Active
Application number
JP2019044609A
Other languages
Japanese (ja)
Other versions
JP2020150356A (en
Inventor
俊一 高瀬
俊一 高瀬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Platforms Ltd
Original Assignee
NEC Platforms Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by NEC Platforms Ltd filed Critical NEC Platforms Ltd
Priority to JP2019044609A priority Critical patent/JP6951019B2/en
Publication of JP2020150356A publication Critical patent/JP2020150356A/en
Application granted granted Critical
Publication of JP6951019B2 publication Critical patent/JP6951019B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Computer And Data Communications (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)
  • Electric Clocks (AREA)

Description

本発明は、カウンタ装置、時刻算出装置、情報処理装置、制御方法、時刻の算出方法及びプログラムに関する。 The present invention includes a counter unit, time calculation unit, the information processing apparatus, control method, a time calculation method and a program.

情報処理装置は、CPUクロックによって動作するカウンタを基にシステムタイマを生成している。この情報処理装置で動作するオペレーティングシステムやタスク間で共有するシステム時刻は、1つのシステムタイマによって時刻情報が管理されている。システムタイマは、NTPサーバから取得した時刻によって更新される。システムタイマが更新されると、タイマ割り込みや時刻参照のタイミングによって、タスクの実行順序が逆転したり、処理が急に進んだりするなど、システムの時間事象に狂いが生じることがある。 The information processing device generates a system timer based on a counter operated by a CPU clock. Time information is managed by one system timer for the system time shared between the operating systems operating in this information processing device and tasks. The system timer is updated according to the time acquired from the NTP server. When the system timer is updated, the time events of the system may be out of order, such as the execution order of tasks being reversed or the processing progressing suddenly, depending on the timing of timer interrupts and time references.

このような事象を回避するため情報処理装置の中には、精度の高いオシレータを搭載し、システム起動時のみNTPサーバから時刻情報を取得して、システム起動後はオシレータを利用することでシステム時刻を管理するものが存在する。この方法の場合、NTPサーバから継続的に時刻情報を取得してシステムタイマを更新することをしない為、システム上の時間事象の逆転などは生じないが、システム起動後の経過時間が長くなるとNTPサーバの時刻とシステム時刻との差が少しずつ開いてしまう。 In order to avoid such an event, a highly accurate oscillator is installed in the information processing device, time information is acquired from the NTP server only when the system is started, and the system time is used after the system is started. There is something to manage. In the case of this method, since the time information is continuously acquired from the NTP server and the system timer is not updated, the time event on the system is not reversed, but the NTP becomes longer after the system is started. The difference between the server time and the system time gradually increases.

関連する技術として、特許文献1には、自機が備える水晶振動子に基づいてシステム時刻の管理を行うプリンタが開示されている。このプリンタは、水晶振動子が所定回数振動する度に1回の基準クロック信号を出力し、この基準クロック信号が所定回数出力されると時刻を1秒進めるようにしてシステム時刻を管理する。このプリンタは、NTPサーバから時刻を取得すると、取得した時刻と自機の時刻とを比較して両者の差分を計算し、差分に相当する補正量を計算する。そして、水晶振動子が(所定回数+補正量)だけ振動すると1回の基準クロック信号を出力するように動作を変更し、これによってシステム時刻の調整を行う。 As a related technique, Patent Document 1 discloses a printer that manages the system time based on a crystal oscillator included in the own machine. This printer outputs a reference clock signal once every time the crystal oscillator vibrates a predetermined number of times, and when the reference clock signal is output a predetermined number of times, the time is advanced by one second to manage the system time. When the printer acquires the time from the NTP server, it compares the acquired time with the time of its own machine, calculates the difference between the two, and calculates the correction amount corresponding to the difference. Then, when the crystal oscillator vibrates (predetermined number of times + correction amount), the operation is changed so as to output one reference clock signal, thereby adjusting the system time.

また、特許文献2には、NTPサーバ装置とNTPクライアント端末装置との間の通信が最小時間で行われた場合のみ、NTPサーバ装置から取得した時刻情報でNTPクライアント端末装置の時刻を更新することにより、サーバ・クライアント間の通信時間の変動に関わらず、NTPサーバ装置とNTPクライアント端末装置との間で、安定した時刻同期を実現する方法が開示されている。 Further, in Patent Document 2, the time of the NTP client terminal device is updated with the time information acquired from the NTP server device only when the communication between the NTP server device and the NTP client terminal device is performed in the minimum time. Discloses a method of achieving stable time synchronization between an NTP server device and an NTP client terminal device regardless of fluctuations in communication time between a server and a client.

特開2003−207586号公報Japanese Unexamined Patent Publication No. 2003-207586 特開2018−098711号公報Japanese Unexamined Patent Publication No. 2018-098711

精度の高いオシレータが無くても、一定の精度を保ちつつ特定の周期でカウントする、CPUクロックに基づいて動作するカウンタが求められている。 There is a demand for a counter that operates based on a CPU clock and counts at a specific cycle while maintaining a constant accuracy even if there is no highly accurate oscillator.

そこでこの発明は、上述の課題を解決するカウンタ装置、時刻算出装置、情報処理装置、制御方法、時刻の算出方法及びプログラムを提供することを目的としている。 Therefore the invention aims at providing a counter apparatus to solve the above problems, time calculation device, an information processing apparatus, control method, a time calculation method and program.

本発明の一態様によれば、カウンタ装置は、CPUのクロックに同期して動作するCPUクロックカウンタのカウント値に換算係数を乗じて、特定の周期で動作する第1カウンタによる第1カウント値を算出する第1カウンタ生成部と、時刻情報を、前記特定の周期で動作する第2カウンタによる第2カウント値に変換する第2カウンタ変換部と、前記第1カウント値と前記第2カウント値の差分が所定の閾値以上となった場合に、前記差分が現在よりも小さくなり、且つ、前記第1カウンタが所定時間に算出する前記第1カウント値の前記換算係数の調整による変動が所定の範囲内となるように、前記換算係数を調整する換算係数算出部と、を備える。 According to one aspect of the present invention, the counter device multiplies the count value of the CPU clock counter that operates in synchronization with the clock of the CPU by a conversion coefficient to obtain the first count value by the first counter that operates in a specific cycle. The first counter generation unit to be calculated, the second counter conversion unit that converts the time information into the second count value by the second counter operating in the specific cycle, and the first count value and the second count value. When the difference becomes equal to or larger than a predetermined threshold value, the difference becomes smaller than the present value, and the fluctuation of the first count value calculated by the first counter at a predetermined time due to the adjustment of the conversion coefficient is within a predetermined range. A conversion coefficient calculation unit for adjusting the conversion coefficient is provided so as to be inside.

また、本発明の他の一態様によれば、時刻算出装置は、上記のカウンタ装置と、前記第1カウント値をカレンダ時刻に変換するカレンダ時刻変換部と、を備える。 Further, according to another aspect of the present invention, time calculation apparatus includes the above counter device, and calendar time conversion unit for converting the first count value in calendar time, the.

また、本発明の他の一態様によれば、情報処理装置は、上記のカウンタ装置と、NTPサーバから時刻情報を取得するNTP時刻取得部と、を備える。 Further, according to another aspect of the present invention, the information processing device includes the above-mentioned counter device and an NTP time acquisition unit that acquires time information from an NTP server.

また、本発明の他の一態様によれば、CPUのクロックに同期して動作するCPUクロックカウンタに基づいて動作する第1カウンタの制御方法であって、前記CPUクロックカウンタのカウント値に換算係数を乗じて、特定の周期で動作する前記第1カウンタによる第1カウント値を算出するステップと、時刻情報を、前記特定の周期で動作する第2カウンタによる第2カウント値に変換するステップと、前記第1カウント値と前記第2カウント値の差分が所定の閾値以上となった場合に、前記差分が現在よりも小さくなり、且つ、前記第1カウンタが所定時間に算出する前記第1カウント値の前記換算係数の調整による変動が所定の範囲内となるように、前記換算係数を調整するステップと、を有する制御方法である。 Further, according to another aspect of the present invention, it is a control method of a first counter that operates based on a CPU clock counter that operates in synchronization with the clock of the CPU, and is converted into a count value of the CPU clock counter. To calculate the first count value by the first counter operating in a specific cycle by multiplying by, and to convert the time information into a second count value by the second counter operating in the specific cycle. When the difference between the first count value and the second count value becomes equal to or greater than a predetermined threshold value, the difference becomes smaller than the present value, and the first count value calculated by the first counter at a predetermined time. This is a control method including a step of adjusting the conversion coefficient so that the fluctuation due to the adjustment of the conversion coefficient is within a predetermined range.

また、本発明の他の一態様によれば、上記の制御方法で前記第1カウンタを制御し、前記第1カウント値に基づいてカレンダ時刻を算出する、カレンダ時刻の算出方法である。 Further, according to another aspect of the present invention, it is a calendar time calculation method in which the first counter is controlled by the above control method and the calendar time is calculated based on the first count value.

また、本発明の他の一態様によれば、プログラムは、コンピュータを、CPUのクロックに同期して動作するCPUクロックカウンタのカウント値に換算係数を乗じて、特定の周期で動作する第1カウンタによる第1カウント値を算出する手段、時刻情報を、前記特定の周期で動作する第2カウンタによる第2カウント値に変換する手段、前記第1カウント値と前記第2カウント値の差分が所定の閾値以上となった場合に、前記差分が現在よりも小さくなり、且つ、前記第1カウンタが所定時間に算出する前記第1カウント値の前記換算係数の調整による変動が所定の範囲内となるように、前記換算係数を調整する手段、として機能させる。
Further, according to another aspect of the present invention, the program operates the computer in a specific cycle by multiplying the count value of the CPU clock counter that operates in synchronization with the CPU clock by a conversion factor. The means for calculating the first count value according to the above, the means for converting the time information into the second count value by the second counter operating in the specific cycle, the difference between the first count value and the second count value is predetermined. When it becomes equal to or more than the threshold value, the difference becomes smaller than the present, and the fluctuation of the first count value calculated by the first counter at a predetermined time due to the adjustment of the conversion coefficient is within a predetermined range. To function as a means for adjusting the conversion coefficient.

本発明によれば、精度よく所定の目標周期でカウントし続けるカウンタを得ることができる。また、このカウンタを用いることにより情報処理装置のシステム時刻の精度を保つことができる。 According to the present invention, it is possible to obtain a counter that keeps counting at a predetermined target cycle with high accuracy. Further, by using this counter, the accuracy of the system time of the information processing apparatus can be maintained.

本発明の第一実施形態に係る情報処理装置の一例を示す図である。It is a figure which shows an example of the information processing apparatus which concerns on 1st Embodiment of this invention. 本発明の第一実施形態による1μ秒カウンタの制御を説明する第1の図である。It is the first figure explaining the control of the 1μ second counter by the 1st Embodiment of this invention. 本発明の第一実施形態による1μ秒カウンタの制御を説明する第2の図である。FIG. 2 is a second diagram illustrating control of a 1 μs counter according to the first embodiment of the present invention. 本発明の第一実施形態による1μ秒カウンタの制御の一例を示すフローチャートである。It is a flowchart which shows an example of the control of 1μ sec counter by 1st Embodiment of this invention. 本発明の第二実施形態に係る情報処理装置の一例を示す図である。It is a figure which shows an example of the information processing apparatus which concerns on 2nd Embodiment of this invention. 本発明の第二実施形態による1μ秒カウンタの制御の一例を示すフローチャートである。It is a flowchart which shows an example of the control of the 1μ second counter by the 2nd Embodiment of this invention. 本発明の一実施形態におけるカウンタ装置の最小構成を示す図である。It is a figure which shows the minimum structure of the counter device in one Embodiment of this invention. 本発明の一実施形態における情報処理装置のハードウェア構成の一例を示す図である。It is a figure which shows an example of the hardware composition of the information processing apparatus in one Embodiment of this invention.

以下、本発明の第一実施形態に係る1μ秒カウンタの制御方法について図面を参照して説明する。図1は、本発明の第一実施形態に係る情報処理装置の一例を示す図である。
図示するように情報処理装置301は、CPUクロックカウンタ10と、1μ秒カウンタ生成部200と、カレンダ時刻変換部201と、NTP時刻取得部202と、NTP時刻取得部202と、1μ秒カウンタ変換部203と、カウント値比較部204と、換算係数算出部205と、設定時刻取得部206と、を備える。
Hereinafter, a method for controlling a 1 μs counter according to the first embodiment of the present invention will be described with reference to the drawings. FIG. 1 is a diagram showing an example of an information processing device according to the first embodiment of the present invention.
As shown in the figure, the information processing apparatus 301 includes a CPU clock counter 10, a 1 μs counter generation unit 200, a calendar time conversion unit 201, an NTP time acquisition unit 202, an NTP time acquisition unit 202, and a 1 μs counter conversion unit. It includes 203, a count value comparison unit 204, a conversion coefficient calculation unit 205, and a set time acquisition unit 206.

CPUクロックカウンタ10は、図示しないCPUに同期して動作し、CPUのクロック周期でカウント値を出力する。CPUクロックカウンタ10は、一般的にCPUの機能としてCPUチップ内部に設けられている。 The CPU clock counter 10 operates in synchronization with a CPU (not shown) and outputs a count value at the clock cycle of the CPU. The CPU clock counter 10 is generally provided inside the CPU chip as a function of the CPU.

1μ秒カウンタ生成部200は、CPUクロックカウンタ10が出力するカウント値に予め設定された換算係数15を乗じて、1μ秒周期でカウント値11を生成する。本実施形態では、1μ秒カウンタ生成部200が動作することによって1μ秒カウンタを実現し、この1μ秒カウンタを時刻計算の基となるシステムクロックとして利用する。1μ秒カウンタは1秒間で1000000回カウントするので、1000000をCPUクロックカウンタ10による1秒間あたりのカウント値で割った値が換算係数15となる。つまり、1μ秒カウンタ生成部200は、CPUクロックカウンタ10が出力するカウント値が、換算係数15の値だけ増加する毎に、1カウントアップしたカウント値11を生成する。例えば、カウント値11はシステム起動時から現時点までの経過時間をμ秒単位で表した値である。 The 1 μs counter generation unit 200 multiplies the count value output by the CPU clock counter 10 by a preset conversion coefficient 15 to generate the count value 11 in a 1 μs cycle. In the present embodiment, the 1 μs counter is realized by the operation of the 1 μs counter generation unit 200, and this 1 μs counter is used as the system clock which is the basis of the time calculation. Since the 1 μs counter counts 1,000,000 times per second, the conversion coefficient 15 is obtained by dividing 1,000,000 by the count value per second by the CPU clock counter 10. That is, the 1 μs counter generation unit 200 generates a count value 11 which is increased by 1 each time the count value output by the CPU clock counter 10 increases by the value of the conversion coefficient 15. For example, the count value 11 is a value expressing the elapsed time from the time the system is started to the present time in units of microseconds.

カレンダ時刻変換部201は、1μ秒カウンタ生成部200が算出した1μ秒単位のカウント値をカレンダ時刻に変換する。
NTP時刻取得部202は、NTPサーバ300から時刻情報(カレンダ時刻16)を取得する。
The calendar time conversion unit 201 converts the count value in 1 μs units calculated by the 1 μs counter generation unit 200 into the calendar time.
The NTP time acquisition unit 202 acquires time information (calendar time 16) from the NTP server 300.

1μ秒カウンタ変換部203は、NTP時刻取得部202が取得したカレンダ時刻16を、1μ秒周期で動作するカウンタによるカウント値に変換する。1μ秒カウンタ変換部203が変換する1μ秒単位のカウント値は、1μ秒カウンタ生成部200が実現する1μ秒カウンタの精度を保つために参照する目的で利用する。NTPサーバ300から取得したカレンダ時刻16のままでは、1μ秒カウンタ生成部200が生成するカウント値11と比較することができない。そこで、1μ秒カウンタ変換部203は、NTP時刻取得部202が取得した時刻情報を1μ秒ごとにカウントアップされるカウント値12に変換する。例えば、カウント値12は特定の日時から現時点までの経過時間をμ秒単位で表した値を示しており、カウント値12とカレンダ時刻の間の相互変換が可能である。また、カウント値12とカウント値11は、共にある時刻を基準として、その時刻からの経過時間を示す値であるから比較可能である。 The 1 μs counter conversion unit 203 converts the calendar time 16 acquired by the NTP time acquisition unit 202 into a count value by a counter operating in a 1 μs cycle. The count value in 1 μs units converted by the 1 μs counter conversion unit 203 is used for the purpose of being referred to in order to maintain the accuracy of the 1 μs counter realized by the 1 μs counter generation unit 200. The calendar time 16 acquired from the NTP server 300 cannot be compared with the count value 11 generated by the 1 μs counter generation unit 200. Therefore, the 1 μs counter conversion unit 203 converts the time information acquired by the NTP time acquisition unit 202 into a count value 12 which is counted up every 1 μs. For example, the count value 12 indicates a value expressing the elapsed time from a specific date and time to the present time in μsecond units, and mutual conversion between the count value 12 and the calendar time is possible. Further, since the count value 12 and the count value 11 are both values indicating the elapsed time from that time with reference to a certain time, they can be compared.

カウント値比較部204は、1μ秒カウンタ生成部200で生成されたカウント値11と1μ秒カウンタ変換部203で変換されたカウント値12の差を求める。1μ秒カウンタ生成部200が生成するカウント値11と1μ秒カウンタ変換部203が変換するカウント値12が、ともに正確に1μ秒ごとに1ずつカウントアップされるならば、カウント値11とカウント値12の差は一定である。しかし、CPUクロックカウンタ10のクロック周期は変動するため、実際には、CPUクロックカウンタ10の動作に基づいて算出されるカウント値11と、カウント値12の差は変動する。徐々にカウント値11がカウント値12より大きくなる傾向が検出されれば、1μ秒カウンタ生成部200による1μ秒カウンタは、実際の1μ秒よりも短い間隔でカウントしていることになる。この場合、カレンダ時刻変換部201が算出する時刻情報は、実際の時刻に比べ進みがちになる。反対にシステム起動時に比べて、徐々にカウント値11がカウント値12より小さくなる傾向が検出されれば、1μ秒カウンタは、実際の1μ秒よりも長い間隔でカウントしていることになり、カレンダ時刻変換部201が算出する時刻情報は、実際の時刻に比べ遅れがちになる。次に説明する換算係数算出部205は、カウント値11の遅延や先行を補正するように換算係数15を調整する。 The count value comparison unit 204 obtains the difference between the count value 11 generated by the 1 μs counter generation unit 200 and the count value 12 converted by the 1 μs counter conversion unit 203. If the count value 11 generated by the 1 μs counter generation unit 200 and the count value 12 converted by the 1 μs counter conversion unit 203 are both accurately counted up by 1 every 1 μs, the count value 11 and the count value 12 The difference is constant. However, since the clock period of the CPU clock counter 10 fluctuates, the difference between the count value 11 calculated based on the operation of the CPU clock counter 10 and the count value 12 actually fluctuates. If it is detected that the count value 11 gradually becomes larger than the count value 12, the 1 μs counter generated by the 1 μs counter generator 200 counts at intervals shorter than the actual 1 μs. In this case, the time information calculated by the calendar time conversion unit 201 tends to advance compared to the actual time. On the contrary, if a tendency that the count value 11 gradually becomes smaller than the count value 12 is detected as compared with the time when the system is started, the 1 μs counter is counting at intervals longer than the actual 1 μs, and the calendar. The time information calculated by the time conversion unit 201 tends to be delayed compared to the actual time. The conversion coefficient calculation unit 205, which will be described next, adjusts the conversion coefficient 15 so as to correct the delay or advance of the count value 11.

換算係数算出部205は、システム起動時にカウント値比較部204から得られる差分値13と、システム起動時から一定時間経過後にカウント値比較部204から得られる差分値14とを比較し、その差が許容範囲(補正指示判断時間17)を上回っていれば、その差が小さくなるように換算係数15の値を更新する。 The conversion coefficient calculation unit 205 compares the difference value 13 obtained from the count value comparison unit 204 at the time of system startup with the difference value 14 obtained from the count value comparison unit 204 after a certain period of time has elapsed from the system startup, and the difference is If it exceeds the permissible range (correction instruction determination time 17), the value of the conversion coefficient 15 is updated so that the difference becomes small.

設定時刻取得部206は、ユーザから情報処理装置301のシステム時刻の設定を受け付ける。システム時刻は、NTPサーバ300が提供する実際の現在時刻であってもよいし、過去や未来の任意の時刻であってもよい。情報処理装置301のシステム時刻には、設定時刻取得部206が受け付けた日時が設定され、設定後のシステム時刻は、1μ秒カウンタ生成部200が生成したカウント値11とカレンダ時刻変換部201によって、精度よく管理される。 The set time acquisition unit 206 receives the setting of the system time of the information processing device 301 from the user. The system time may be the actual current time provided by the NTP server 300, or may be any time in the past or future. The system time of the information processing device 301 is set to the date and time received by the set time acquisition unit 206, and the system time after the setting is set by the count value 11 generated by the 1 μs counter generation unit 200 and the calendar time conversion unit 201. It is managed accurately.

一般にサーバ装置などに使用されるCPUクロックカウンタ10のクロック周期の精度は、十分ではないことが多く、例えば、情報処理装置301自身の発熱や周囲の環境の影響などによっても変動することがある。上記の通り、CPUクロックカウンタ10の動作精度は、そのまま1μ秒カウンタ生成部200が生成するカウント値11の精度となり、カレンダ時刻変換部201で変換されるシステム時刻の精度となる。そのため、CPUクロックカウンタ10のクロック周期が変動すると、情報処理装置301のシステム時刻にも狂いが生じ、タスクの実行などにも影響が及ぶ可能性がある。これに対し、本実施形態では、精度の高いオシレータなどを用いずに、情報処理装置301の稼働中にNTPサーバ300から定期的に時刻情報を取得し、時刻情報に基づいて、換算係数15の値を調整する。そして、CPUクロックカウンタ10のクロック周期に換算係数15を乗じた時間がある程度以上の精度で1μ秒を保つように制御する。
次に換算係数15の調整方法について図2および図3を参照して説明する。
In general, the accuracy of the clock cycle of the CPU clock counter 10 used in a server device or the like is often not sufficient, and may fluctuate due to, for example, heat generation of the information processing device 301 itself or the influence of the surrounding environment. As described above, the operating accuracy of the CPU clock counter 10 is the accuracy of the count value 11 generated by the 1 μs counter generation unit 200 as it is, and the accuracy of the system time converted by the calendar time conversion unit 201. Therefore, if the clock cycle of the CPU clock counter 10 fluctuates, the system time of the information processing apparatus 301 may also be out of order, which may affect the execution of tasks. On the other hand, in the present embodiment, the time information is periodically acquired from the NTP server 300 during the operation of the information processing apparatus 301 without using a highly accurate oscillator or the like, and the conversion coefficient 15 is set based on the time information. Adjust the value. Then, the time obtained by multiplying the clock period of the CPU clock counter 10 by the conversion coefficient 15 is controlled so as to maintain 1 μsec with an accuracy of a certain level or more.
Next, a method of adjusting the conversion coefficient 15 will be described with reference to FIGS. 2 and 3.

図2は、本発明の第一実施形態によるカウンタの制御を説明する第1の図である。
図3は、本発明の第一実施形態によるカウンタの制御を説明する第2の図である。
システム起動直後を最初の測定ポイントの時刻T0とする。まず、カウント値比較部204が、1μ秒カウンタ変換部203が時刻T0に変換したカウント値12(Tb0)と、1μ秒カウンタ生成部200が時刻T0に生成したカウント値11(Ta0)との差分値13(Tc0)を、Ta0−Tb0によって算出する。この差分値13(Tc0)を時間補正の基準値とする。
FIG. 2 is a first diagram illustrating control of a counter according to the first embodiment of the present invention.
FIG. 3 is a second diagram illustrating control of the counter according to the first embodiment of the present invention.
Immediately after the system is started, the time T0 of the first measurement point is set. First, the difference between the count value 12 (Tb0) converted by the 1 μs counter conversion unit 203 to the time T0 by the count value comparison unit 204 and the count value 11 (Ta0) generated by the 1 μs counter generation unit 200 at the time T0. The value 13 (Tc0) is calculated by Ta0-Tb0. This difference value 13 (Tc0) is used as a reference value for time correction.

その後、時刻Tc0から一定時間が経過し、次の測定ポイント(時刻Tx)を迎えると、カウント値比較部204は、時刻Txにおけるカウント値11(Tax)およびカウント値12(Tbx)の差分値14(差分値Tcx)を、Tax−Tbxによって算出する。そして、換算係数算出部205が、差分値13(Tc0)と差分値14(Tcx)の比較を行う。差分値13(Tc0)と差分値14(Tcx)の差が補正指示判断時間17の示す値(Ts)の範囲内であれば(図3の3行目の設定)、1μ秒カウンタ生成部200のカウント周期は、ほぼ1μ秒を維持しているとみなし、換算係数算出部205は、換算係数15の補正は行わない。 After that, when a certain time elapses from the time Tc0 and the next measurement point (time Tx) is reached, the count value comparison unit 204 determines the difference value 14 between the count value 11 (Tax) and the count value 12 (Tbx) at the time Tx. (Difference value Tcx) is calculated by Tax-Tbx. Then, the conversion coefficient calculation unit 205 compares the difference value 13 (Tc0) with the difference value 14 (Tcx). If the difference between the difference value 13 (Tc0) and the difference value 14 (Tcx) is within the range of the value (Ts) indicated by the correction instruction determination time 17 (setting in the third line of FIG. 3), the 1 μs counter generator 200 It is considered that the count cycle of is maintained at about 1 μsec, and the conversion coefficient calculation unit 205 does not correct the conversion coefficient 15.

差分値13(Tc0)よりも差分値14(Tcx)が小さく、かつその差が、補正指示判断時間17が示す時間差(Ts)よりも大きい場合(図3の1行目の設定)、1μ秒カウンタ生成部200が生成するカウント値11が遅れていると判断し、換算係数算出部205は、1μ秒カウンタ生成部200が生成するカウント値11が進むように換算係数15を新たに求める。つまり、換算係数算出部205は、換算係数15をシステム起動時に設定した値よりも大きな値に更新する。 When the difference value 14 (Tcx) is smaller than the difference value 13 (Tc0) and the difference is larger than the time difference (Ts) indicated by the correction instruction determination time 17 (setting in the first line of FIG. 3), 1 μsec. It is determined that the count value 11 generated by the counter generation unit 200 is delayed, and the conversion coefficient calculation unit 205 newly obtains the conversion coefficient 15 so that the count value 11 generated by the counter generation unit 200 advances for 1 μs. That is, the conversion coefficient calculation unit 205 updates the conversion coefficient 15 to a value larger than the value set at the time of system startup.

また、差分値13(Tc0)よりも差分値14(Tcx)が大きく、かつその差が、補正指示判断時間17が示す時間差(Ts)よりも大きい場合(図3の2行目の設定)、カウント値11が進んでいると判断し、換算係数算出部205は、1μ秒カウンタ生成部200が生成するカウント値11が遅れるように換算係数15を新たに求める。つまり、換算係数算出部205は、換算係数15を、システム起動時に設定した値よりも小さな値に更新する。 Further, when the difference value 14 (Tcx) is larger than the difference value 13 (Tc0) and the difference is larger than the time difference (Ts) indicated by the correction instruction determination time 17 (setting in the second line of FIG. 3). Determining that the count value 11 is advanced, the conversion coefficient calculation unit 205 newly obtains the conversion coefficient 15 so that the count value 11 generated by the 1 μs counter generation unit 200 is delayed. That is, the conversion coefficient calculation unit 205 updates the conversion coefficient 15 to a value smaller than the value set at the time of system startup.

このようにして1μ秒カウンタ生成部200が算出するカウント値11の精度を保つことができる。また、カレンダ時刻変換部201がカウント値11を変換して算出するシステム時刻は、上記の換算係数15の補正により、NTPサーバ300から取得したカレンダ時刻16との差が一定時間内に収まるように補正される。つまり、換算係数15の更新および更新後の換算係数15による時刻補正を定期的に行うことにより、システム時刻の精度を保つことが可能となる。 In this way, the accuracy of the count value 11 calculated by the 1 μs counter generation unit 200 can be maintained. Further, the system time calculated by the calendar time conversion unit 201 by converting the count value 11 is set so that the difference from the calendar time 16 acquired from the NTP server 300 is within a certain time by the correction of the conversion coefficient 15 described above. It will be corrected. That is, the accuracy of the system time can be maintained by periodically updating the conversion coefficient 15 and correcting the time by the converted conversion coefficient 15 after the update.

次に第一実施形態における1μ秒カウンタの制御方法について説明する。
図4は、本発明の第一実施形態による1μ秒カウンタ(カウント値11)の制御の一例を示すフローチャートである。
前提として、CPUクロックカウンタ10の設計値などに基づいて、CPUクロックカウンタ10のクロック周期を1μ秒に変換する換算係数15の初期値Kが予め算出され、1μ秒カウンタ生成部200は、このKをCPUクロックカウンタ10のカウント値に乗じてカレンダ時刻変換部201へ出力するよう構成されているとする。
Next, a method of controlling the 1 μs counter in the first embodiment will be described.
FIG. 4 is a flowchart showing an example of control of a 1 μs counter (count value 11) according to the first embodiment of the present invention.
As a premise, the initial value K 0 of the conversion coefficient 15 that converts the clock period of the CPU clock counter 10 to 1 μsec is calculated in advance based on the design value of the CPU clock counter 10, and the 1 μsec counter generator 200 uses this. It is assumed that K 0 is multiplied by the count value of the CPU clock counter 10 and output to the calendar time conversion unit 201.

まず、ユーザが情報処理装置301を起動する。カウント値比較部204は、システム起動時に基準となる差分値(Tc0)を算出する(ステップS11)。具体的には、NTP時刻取得部202は、NTPサーバ300からカレンダ時刻16を取得する。1μ秒カウンタ変換部203は、カレンダ時刻16を1μ秒単位のカウント値12に変換する。例えば、カウント値12は、特定の日時から取得したカレンダ時刻16が示す時点までの経過時間を1μ秒単位でカウントしたときのカウント値を示している。1μ秒カウンタ変換部203は、カウント値12をカウント値比較部204へ出力する。 First, the user activates the information processing device 301. The count value comparison unit 204 calculates a reference difference value (Tc0) when the system is started (step S11). Specifically, the NTP time acquisition unit 202 acquires the calendar time 16 from the NTP server 300. The 1 μs counter conversion unit 203 converts the calendar time 16 into a count value 12 in 1 μs units. For example, the count value 12 indicates a count value when the elapsed time from a specific date and time to the time indicated by the calendar time 16 is counted in units of 1 μsecond. The 1 μs counter conversion unit 203 outputs the count value 12 to the count value comparison unit 204.

一方、1μ秒カウンタ生成部200は、CPUクロックカウンタ10からカウント値を取得し、換算係数15の初期値Kを乗じてカウント値11を生成する。1μ秒カウンタ生成部200は、カウント値11をカウント値比較部204へ出力する。
カウント値比較部204は、カウント値11の初期値(Ta0)から、カウント値12の初期値(Tb0)を減じて両者の差分値(Tc0)を算出する。カウント値比較部204は、基準となる差分値(Tc0)を記憶する。
On the other hand, the 1 μs counter generation unit 200 acquires the count value from the CPU clock counter 10 and multiplies the initial value K 0 of the conversion coefficient 15 to generate the count value 11. The 1 μs counter generation unit 200 outputs the count value 11 to the count value comparison unit 204.
The count value comparison unit 204 calculates the difference value (Tc0) between the two by subtracting the initial value (Tb0) of the count value 12 from the initial value (Ta0) of the count value 11. The count value comparison unit 204 stores a reference difference value (Tc0).

これらの処理と並行して、1μ秒カウンタ生成部200は、カウント値11をカレンダ時刻変換部201へ出力する。また、ユーザは、情報処理装置301のシステム時刻として設定する時刻を情報処理装置301へ入力する。ユーザが入力する設定時刻は、任意の日時でもよいし、NTPサーバ300から取得した現在の時刻に情報処理装置301のシステム時刻を合わせることを指示する情報でもよい。設定時刻取得部206は、ユーザが入力した設定時刻を取得し、カレンダ時刻変換部201へ出力する。カレンダ時刻変換部201は、最新のカウント値11をユーザが指定した設定時刻に変換してシステム時刻を設定する。 In parallel with these processes, the 1 μs counter generation unit 200 outputs the count value 11 to the calendar time conversion unit 201. Further, the user inputs the time set as the system time of the information processing device 301 to the information processing device 301. The set time input by the user may be any date and time, or may be information instructing the system time of the information processing apparatus 301 to be adjusted to the current time acquired from the NTP server 300. The set time acquisition unit 206 acquires the set time input by the user and outputs it to the calendar time conversion unit 201. The calendar time conversion unit 201 converts the latest count value 11 into a set time specified by the user and sets the system time.

また、NTP時刻取得部202は、所定の時間間隔でNTPサーバ300からカレンダ時刻16を取得し、そのたびに1μ秒カウンタ変換部203はカウント値12を算出する。また、1μ秒カウンタ生成部200は、CPUクロックカウンタ10の動作に基づいて1μ秒ごとにカウント値11を算出し、カレンダ時刻変換部201は、そのカウント値11に基づいてシステム時刻に変換する処理を継続して行う。また、カウント値比較部204は、1μ秒カウンタ生成部200と1μ秒カウンタ変換部203から、それぞれカウント値11とカウント値12を取得しつつ、測定ポイントの到来を待機する(ステップS12)。 Further, the NTP time acquisition unit 202 acquires the calendar time 16 from the NTP server 300 at predetermined time intervals, and the 1 μs counter conversion unit 203 calculates the count value 12 each time. Further, the 1 μs counter generation unit 200 calculates the count value 11 every 1 μs based on the operation of the CPU clock counter 10, and the calendar time conversion unit 201 converts the count value 11 into the system time based on the count value 11. Continue to do. Further, the count value comparison unit 204 waits for the arrival of the measurement point while acquiring the count value 11 and the count value 12 from the 1 μs counter generation unit 200 and the 1 μs counter conversion unit 203, respectively (step S12).

測定ポイントが到来すると(ステップS12;Yes)、カウント値比較部204は、最新のカウント値11(Tax)から、カウント値12(Tbx)を減じて、両者の差分値(Tcx)を算出する。そして、カウント値比較部204は、最新の差分値(Tcx)と基準となる差分値(Tc0)とを換算係数算出部205へ出力する。 When the measurement point arrives (step S12; Yes), the count value comparison unit 204 subtracts the count value 12 (Tbx) from the latest count value 11 (Tax) to calculate the difference value (Tcx) between the two. Then, the count value comparison unit 204 outputs the latest difference value (Tcx) and the reference difference value (Tc0) to the conversion coefficient calculation unit 205.

換算係数算出部205は、最新の差分値(Tcx)と基準となる差分値(Tc0)を比較し、両者の大小関係と差の絶対値を算出する。換算係数算出部205は、算出した大小関係と差の絶対値に基づいて換算係数15の値を調整する。Tc0とTcxの差が所定の範囲内(差が補正指示判断時間17以下)の場合(ステップS13;Yes)、換算係数算出部205は、換算係数15を更新しない(ステップS14)。1μ秒カウンタ生成部200は、CPUクロックカウンタ10が出力するカウント値に、これまでと同じ換算係数15を乗じて生成したカウント値11をカレンダ時刻変換部201へ出力する。 The conversion coefficient calculation unit 205 compares the latest difference value (Tcx) with the reference difference value (Tc0), and calculates the magnitude relationship between the two and the absolute value of the difference. The conversion coefficient calculation unit 205 adjusts the value of the conversion coefficient 15 based on the calculated magnitude relationship and the absolute value of the difference. When the difference between Tc0 and Tcx is within a predetermined range (the difference is the correction instruction determination time 17 or less) (step S13; Yes), the conversion coefficient calculation unit 205 does not update the conversion coefficient 15 (step S14). The 1 μs counter generation unit 200 outputs the count value 11 generated by multiplying the count value output by the CPU clock counter 10 by the same conversion coefficient 15 as before to the calendar time conversion unit 201.

Tc0とTcxの差が補正指示判断時間17以上の場合(ステップS13;No)、換算係数算出部205は、換算係数15を更新する(ステップS15)。より具体的には、図3を参照して説明したようにTcx>Tc0ならば、換算係数15を小さくし、Tcx<Tc0ならば、換算係数15を大きくする。例えば、システム起動時に設定した換算係数15の値をKとした場合、1時間でt秒遅らせるようにするための換算係数KnはKn=(1−t/3600)×Kで算出する。1時間でt秒進むようにするための換算係数15の値KnはKn=(1+t/3600)×Kで算出する。
換算係数算出部205は、更新後の換算係数15を、1μ秒カウンタ生成部200へ出力する。1μ秒カウンタ生成部200は、CPUクロックカウンタ10が出力するカウント値に、更新後の新たな換算係数15を乗じて生成したカウント値11をカレンダ時刻変換部201へ出力する。
When the difference between Tc0 and Tcx is the correction instruction determination time 17 or more (step S13; No), the conversion coefficient calculation unit 205 updates the conversion coefficient 15 (step S15). More specifically, as described with reference to FIG. 3, if Tcx> Tc0, the conversion coefficient 15 is decreased, and if Tcx <Tc0, the conversion coefficient 15 is increased. For example, when the value of the conversion coefficient 15 set at the time of system startup is set to K 0 , the conversion coefficient Kn for delaying by t seconds in 1 hour is calculated by Kn = (1-t / 3600) × K 0. The value Kn of the conversion coefficient 15 for advancing by t seconds in one hour is calculated by Kn = (1 + t / 3600) × K 0.
The conversion coefficient calculation unit 205 outputs the updated conversion coefficient 15 to the 1 μs counter generation unit 200. The 1 μs counter generation unit 200 outputs the count value 11 generated by multiplying the count value output by the CPU clock counter 10 by the new conversion coefficient 15 after the update to the calendar time conversion unit 201.

次にカレンダ時刻変換部201は、カウント値11をシステム時刻に変換する(ステップS16)。次に情報処理装置301のシステムを停止するかどうかを判定する(ステップS17)。停止しない場合(ステップS17;No)、ステップS12以降の処理を繰り返す。これにより、システムの起動中、カウント値11が遅延しすぎたり、先行しすぎたりすると換算係数15の値が調整され、カウント値11は、一定の精度で1μ秒ごとに出力される。また、情報処理装置301のシステム時刻も一定の精度に保たれる。 Next, the calendar time conversion unit 201 converts the count value 11 into the system time (step S16). Next, it is determined whether or not to stop the system of the information processing device 301 (step S17). If it does not stop (step S17; No), the processes after step S12 are repeated. As a result, if the count value 11 is delayed or preceded too much during system startup, the value of the conversion coefficient 15 is adjusted, and the count value 11 is output with a constant accuracy every 1 μs. Further, the system time of the information processing apparatus 301 is also maintained at a constant accuracy.

システム停止する場合(ステップS17;Yes)、一連の処理を停止する。そして、再度、システムが起動されると、ステップS11からの処理が実行される。 When the system is stopped (step S17; Yes), a series of processes is stopped. Then, when the system is started again, the process from step S11 is executed.

本実施形態によれば、高精度のオシレータなど専用のハードウェアを必要とせず、高精度なCPUクロックに基づくカウンタを生成することができる。また、例えば、NTPサーバ300が提供する時刻とのずれが検出された場合に、急激にNTPサーバ300の時刻に同期させるのではなく、換算係数15を調整することにより、少しずつNTPサーバ300の時刻に近づけていくことができるため、タスク間の実行順の逆転などが生じない。従って、システム運用中にシステムの動作に影響を与えることなく、NTPサーバ300の時刻に同期させることができる。 According to this embodiment, it is possible to generate a counter based on a high-precision CPU clock without requiring dedicated hardware such as a high-precision oscillator. Further, for example, when a deviation from the time provided by the NTP server 300 is detected, the NTP server 300 is gradually adjusted by adjusting the conversion coefficient 15 instead of suddenly synchronizing with the time of the NTP server 300. Since the time can be approached, the execution order between tasks is not reversed. Therefore, it is possible to synchronize with the time of the NTP server 300 without affecting the operation of the system during system operation.

なお、カレンダ時刻16は、NTPサーバ300とNTP時刻取得部202の間でインターネットを利用して取得するため、通信による遅れなどのタイムラグが考えられるが、本実施形態では、NTPサーバ300との時間差が広がらないように常時1秒程度の補正ができればよく、NTPサーバ300との時間差が、例えば、数百ミリ秒程存在してもよい。 Since the calendar time 16 is acquired between the NTP server 300 and the NTP time acquisition unit 202 using the Internet, a time lag such as a delay due to communication can be considered, but in the present embodiment, the time difference from the NTP server 300 is considered. It suffices if the correction can be made for about 1 second at all times so that the time difference does not spread, and the time difference from the NTP server 300 may exist, for example, about several hundred milliseconds.

<第二実施形態>
以下、本発明の第二実施形態による1μ秒カウンタの制御方法について図5〜図6を参照して説明する。
第一実施形態では、NTPサーバ300との通信が可能であることを前提とした。しかし、通信障害などにより、NTPサーバ300から最新の時刻情報(カレンダ時刻16)が取得できない状況も生じ得る。この場合、1μ秒カウンタ変換部203は、NTPサーバ300から取得した時刻情報に基づいてカウント値12を生成することができず、第一実施形態の方法でカウント値11を補正することができない。すると、1μ秒カウンタ生成部200が参照する換算係数15の値は、通信回線が正常になるまで固定される。このとき、カウント値11の値は完全にCPUクロックカウンタ10のクロック数に比例した値となるが、CPUクロックカウンタ10のクロック周期には揺らぎがあり、そのクロック周期も装置によって個体差があるため、それを利用して生成されるカウント値11の精度は低くなる可能性がある。これを回避するため、第二実施形態に係る情報処理装置301aは、通信回線が正常な時にあらかじめ長時間CPUクロックカウンタ10のカウント値およびカウント値12の測定を行い、CPUクロックカウンタ10のクロック周期を平均化した値に基づいて換算係数15aを算出しておく。そして、NTPサーバ300から時刻情報が取得できない間は、CPUクロックカウンタ10の揺らぎを考慮して設定された換算係数15aを用いるようにし、1μ秒カウンタの精度を一定以上に保つ。
<Second embodiment>
Hereinafter, a method of controlling the 1 μs counter according to the second embodiment of the present invention will be described with reference to FIGS. 5 to 6.
In the first embodiment, it is assumed that communication with the NTP server 300 is possible. However, there may be a situation where the latest time information (calendar time 16) cannot be obtained from the NTP server 300 due to a communication failure or the like. In this case, the 1 μs counter conversion unit 203 cannot generate the count value 12 based on the time information acquired from the NTP server 300, and cannot correct the count value 11 by the method of the first embodiment. Then, the value of the conversion coefficient 15 referred to by the 1 μs counter generation unit 200 is fixed until the communication line becomes normal. At this time, the value of the count value 11 is completely proportional to the number of clocks of the CPU clock counter 10, but the clock cycle of the CPU clock counter 10 fluctuates, and the clock cycle also varies from device to device. , The accuracy of the count value 11 generated by using it may be low. In order to avoid this, the information processing apparatus 301a according to the second embodiment measures the count value and the count value 12 of the CPU clock counter 10 for a long time in advance when the communication line is normal, and the clock period of the CPU clock counter 10 The conversion coefficient 15a is calculated based on the averaged value of. Then, while the time information cannot be acquired from the NTP server 300, the conversion coefficient 15a set in consideration of the fluctuation of the CPU clock counter 10 is used, and the accuracy of the 1 μs counter is kept above a certain level.

図5は、本発明の第二実施形態に係る情報処理装置の一例を示す図である。
情報処理装置301aは、第一実施形態の構成に加え、事前換算係数算出部400と、時刻同期異常検出部401と、換算係数切り替え部402と、換算係数保持部403と、を備える。第二実施形態に係る構成のうち、第一実施形態と同じ構成には同じ符号を付し、それらの説明を省略する。
FIG. 5 is a diagram showing an example of an information processing device according to the second embodiment of the present invention.
In addition to the configuration of the first embodiment, the information processing apparatus 301a includes a pre-conversion coefficient calculation unit 400, a time synchronization abnormality detection unit 401, a conversion coefficient switching unit 402, and a conversion coefficient holding unit 403. Among the configurations according to the second embodiment, the same configurations as those of the first embodiment are designated by the same reference numerals, and the description thereof will be omitted.

事前換算係数算出部400は、システム起動時から所定時間が経過するまでにCPUクロックカウンタ10が出力するカウント値と、システム起動時から所定時間が経過するまでに1μ秒カウンタ変換部203が出力するカウント値12に基づいて、NTPサーバ300から時刻情報を取得できない状況で用いる換算係数15aを算出する。 The pre-conversion coefficient calculation unit 400 outputs a count value output by the CPU clock counter 10 from the time the system is started until a predetermined time elapses, and a 1 μs counter conversion unit 203 outputs the count value from the time the system is started until the predetermined time elapses. Based on the count value 12, the conversion coefficient 15a used in the situation where the time information cannot be acquired from the NTP server 300 is calculated.

時刻同期異常検出部401は、NTP時刻取得部202によるNTPサーバ300からの時刻情報の取得が回線などの異常によって正常にできなくなったことを検出する。
換算係数切り替え部402は、時刻同期異常検出部401が異常を検出した場合、通常動作時に使用している換算係数15から換算係数15aに切り替え、通信が正常に戻った場合は元の換算係数15に戻す切り替え制御を行う。
換算係数保持部403は、事前換算係数算出部400が算出した換算係数15aの値を保持する。
The time synchronization abnormality detection unit 401 detects that the NTP time acquisition unit 202 cannot normally acquire the time information from the NTP server 300 due to an abnormality in the line or the like.
The conversion coefficient switching unit 402 switches from the conversion coefficient 15 used during normal operation to the conversion coefficient 15a when the time synchronization abnormality detection unit 401 detects an abnormality, and when communication returns to normal, the original conversion coefficient 15 Performs switching control to return to.
The conversion coefficient holding unit 403 holds the value of the conversion coefficient 15a calculated by the pre-conversion coefficient calculation unit 400.

次に事前換算係数算出部400による換算係数15aの算出方法について説明する。
システム起動時の時刻をT0とする。事前換算係数算出部400は、時刻T0にCPUクロックカウンタ10が出力するカウント値Td0と、時刻T0に1μ秒カウンタ変換部203が出力するカウント値12の値Tn0を記憶する。さらに事前換算係数算出部400は、CPUクロックカウンタ10のクロックのゆらぎが平均化できるよう長時間(T1時間)待つ。T1時間が経過すると、事前換算係数算出部400は、T1時間後にCPUクロックカウンタ10が出力するカウント値Td1と、T1時間後に1μ秒カウンタ変換部203が出力するカウント値12の値Tn1を記憶する。そして、事前換算係数算出部400は、CPUクロックカウンタ10のクロックのゆらぎを平均化した換算係数15aの値Kaを、下記の式(1)によって算出する。
Ka=(Tn1−Tn0)/(Td1−Td0)・・・(1)
事前換算係数算出部400は、算出した値Kaを換算係数保持部403へ出力する。換算係数保持部403は、値Kaを記憶する。
Next, a method of calculating the conversion coefficient 15a by the pre-conversion coefficient calculation unit 400 will be described.
Let T0 be the time when the system starts up. The pre-conversion coefficient calculation unit 400 stores the count value Td0 output by the CPU clock counter 10 at time T0 and the value Tn0 of the count value 12 output by the 1 μs counter conversion unit 203 at time T0. Further, the pre-conversion coefficient calculation unit 400 waits for a long time (T1 hour) so that the fluctuation of the clock of the CPU clock counter 10 can be averaged. When the T1 time elapses, the pre-conversion coefficient calculation unit 400 stores the count value Td1 output by the CPU clock counter 10 after T1 hour and the value Tn1 of the count value 12 output by the 1 μs counter conversion unit 203 after T1 hour. .. Then, the pre-conversion coefficient calculation unit 400 calculates the value Ka of the conversion coefficient 15a, which is the average of the clock fluctuation of the CPU clock counter 10, by the following equation (1).
Ka = (Tn1-Tn0) / (Td1-Td0) ... (1)
The pre-conversion coefficient calculation unit 400 outputs the calculated value Ka to the conversion coefficient holding unit 403. The conversion coefficient holding unit 403 stores the value Ka.

次に第二実施形態における1μ秒カウンタ(カウント値11)の制御方法について説明する。
図6は、本発明の第二実施形態による1μ秒カウンタの制御の一例を示すフローチャートである。
システム起動後、T1時間が経過するまでの間、NTPサーバ300との通信が可能であるとして説明を行う。
まず、ユーザの操作により情報処理装置301aのシステムが起動する(ステップS21)。事前換算係数算出部400は、システム起動直後(時刻T0)におけるCPUクロックカウンタ10のカウント値Td0と、1μ秒カウンタ変換部203のカウント値12の値Tn0を記憶する。
次に時刻同期異常検出部401は、NTPサーバ300との通信が正常かどうかを判定する(ステップS22)。通信が正常な場合(ステップS22;Yes)、換算係数切り替え部402は、1μ秒カウンタ生成部200が使用する換算係数に、換算係数15を設定する(ステップS23)。すると、図4を参照して説明した処理によって、換算係数算出部205が、換算係数15を更新等し、1μ秒カウンタ生成部200が生成するカウント値11の精度を維持する(ステップS24)。
Next, a method of controlling the 1 μs counter (count value 11) in the second embodiment will be described.
FIG. 6 is a flowchart showing an example of control of a 1 μs counter according to the second embodiment of the present invention.
It will be described that communication with the NTP server 300 is possible until T1 time elapses after the system is started.
First, the system of the information processing device 301a is started by the user's operation (step S21). The pre-conversion coefficient calculation unit 400 stores the count value Td0 of the CPU clock counter 10 immediately after the system is started (time T0) and the value Tn0 of the count value 12 of the 1 μs counter conversion unit 203.
Next, the time synchronization abnormality detection unit 401 determines whether or not the communication with the NTP server 300 is normal (step S22). When the communication is normal (step S22; Yes), the conversion coefficient switching unit 402 sets the conversion coefficient 15 as the conversion coefficient used by the 1 μs counter generation unit 200 (step S23). Then, the conversion coefficient calculation unit 205 updates the conversion coefficient 15 or the like by the process described with reference to FIG. 4, and maintains the accuracy of the count value 11 generated by the 1 μs counter generation unit 200 (step S24).

また、事前換算係数算出部400は、システム起動後、時間T1が経過し、且つ、換算係数15aが未算出かどうかを判定する(ステップS25)。これらの条件を満たす場合(ステップS25;Yes)、事前換算係数算出部400は、時間T1経過後におけるCPUクロックカウンタ10のカウント値Td1と、1μ秒カウンタ変換部203のカウント値12の値Tn1と、先に記憶した値Td0、Tn1とを用いて、換算係数15aの値Kaを、上記の式(1)により算出する(ステップS26)。換算係数保持部403は、事前換算係数算出部400が算出した値Kaを保持する。時間T1が経過していない場合や換算係数15aが算出済みの場合(ステップS25;No)、換算係数15aの算出は行わず、ステップS28の処理に進む。 Further, the pre-conversion coefficient calculation unit 400 determines whether or not the time T1 has elapsed and the conversion coefficient 15a has not been calculated after the system is started (step S25). When these conditions are satisfied (step S25; Yes), the pre-conversion coefficient calculation unit 400 sets the count value Td1 of the CPU clock counter 10 after the lapse of time T1 and the value Tn1 of the count value 12 of the 1 μs counter conversion unit 203. Using the previously stored values Td0 and Tn1, the value Ka of the conversion coefficient 15a is calculated by the above equation (1) (step S26). The conversion coefficient holding unit 403 holds the value Ka calculated by the pre-conversion coefficient calculation unit 400. If the time T1 has not elapsed or the conversion coefficient 15a has already been calculated (step S25; No), the conversion coefficient 15a is not calculated and the process proceeds to step S28.

次にカレンダ時刻変換部201は、カウント値11をカレンダ時刻に変換する(ステップS28)。情報処理装置301のシステムを停止する場合(ステップS28;Yes)、本フローチャートの処理を終了する。システムを停止しない場合(ステップS28;No)、ステップS22以降の処理を繰り返す。例えば、ステップS22で時刻同期異常検出部401が、通信異常を検出すると、換算係数切り替え部402は、1μ秒カウンタ生成部200が使用する換算係数を、換算係数15から換算係数保持部403が保持する換算係数15aに切り替える(ステップS27)。換算係数15aは、クロック周期の揺らぎを平均化したCPUクロックカウンタ10のカウント値を、実際の時刻情報に基づく1μ秒周期で動作するカウンタが出力するカウント値に変換する係数である。通信異常が検出される間、1μ秒カウンタ生成部200は、CPUクロックカウンタ10が出力するカウント値に換算係数15aを乗じて生成したカウント値11を、カレンダ時刻変換部201へ出力する。カレンダ時刻変換部201は、カウント値11をカレンダ時刻に変換する(ステップS28)。 Next, the calendar time conversion unit 201 converts the count value 11 into the calendar time (step S28). When the system of the information processing apparatus 301 is stopped (step S28; Yes), the processing of this flowchart is terminated. When the system is not stopped (step S28; No), the processes after step S22 are repeated. For example, when the time synchronization abnormality detection unit 401 detects a communication abnormality in step S22, the conversion coefficient switching unit 402 holds the conversion coefficient used by the 1 μs counter generation unit 200 from the conversion coefficient 15 to the conversion coefficient holding unit 403. The conversion coefficient is switched to 15a (step S27). The conversion coefficient 15a is a coefficient that converts the count value of the CPU clock counter 10 that averages the fluctuation of the clock cycle into the count value output by the counter that operates in a cycle of 1 μsec based on the actual time information. While the communication abnormality is detected, the 1 μs counter generation unit 200 outputs the count value 11 generated by multiplying the count value output by the CPU clock counter 10 by the conversion coefficient 15a to the calendar time conversion unit 201. The calendar time conversion unit 201 converts the count value 11 into the calendar time (step S28).

そして、NTPサーバ300との通信が回復すると、換算係数切り替え部402は、1μ秒カウンタ生成部200が使用する換算係数を、換算係数15aから換算係数15に切り替える。そして、第一実施形態と同様の制御を行う。 Then, when the communication with the NTP server 300 is restored, the conversion coefficient switching unit 402 switches the conversion coefficient used by the 1 μs counter generation unit 200 from the conversion coefficient 15a to the conversion coefficient 15. Then, the same control as in the first embodiment is performed.

本実施形態によれば、何らかの障害でNTPサーバ300と通信ができない状態を想定して予めCPUクロックカウンタ10の揺らぎを平均化した換算係数15aを求めておき、回線障害が発生した場合は換算係数15aを利用することができる。これにより、第一実施形態の効果に加え、NTPサーバ300から時刻情報が取得できない状況でも、ある程度の精度を保持した状態でカウント値11を生成することができる。従って、時刻補正用のオシレータなどの専用ハードウェアを必要とすることなく、専用ハードウェアに近い精度でシステムタイマを構成することが可能となる。
なお、ステップS25では、一度換算係数15aを算出した後は、更新しないこととしたが、例えば、時間T1が経過する度に、最新の時間T1の開始と終了時点におけるCPUクロックカウンタ10のカウント値とカウント値12に基づいて、換算係数15aを算出してもよい。
According to the present embodiment, assuming a state in which communication with the NTP server 300 cannot be performed due to some failure, a conversion coefficient 15a obtained by averaging the fluctuations of the CPU clock counter 10 is obtained in advance, and when a line failure occurs, the conversion coefficient is obtained. 15a can be used. As a result, in addition to the effect of the first embodiment, the count value 11 can be generated while maintaining a certain degree of accuracy even in a situation where the time information cannot be acquired from the NTP server 300. Therefore, it is possible to configure the system timer with an accuracy close to that of the dedicated hardware without requiring a dedicated hardware such as an oscillator for time correction.
In step S25, once the conversion coefficient 15a is calculated, it is not updated. For example, every time the time T1 elapses, the count value of the CPU clock counter 10 at the start and end of the latest time T1. And the conversion coefficient 15a may be calculated based on the count value 12.

また、近年のコンピューティング環境では、複数の情報処理装置をネットワーク接続し、複数システムを協調して運用することが求められる場面が増加している。このようなシステムでは、各情報処理装置のシステム時刻を一致させる必要があるが、システム運用中にNTPサーバから取得した時刻情報に基づいて、瞬間的に時刻を変更するとオペレーティングシステムやタスク間の時間関係が逆転してしまう可能性がある。これに対し、第一実施形態、第二実施形態が提供する1μ秒カウンタ(1μ秒カウンタ生成部200)によれば、各情報処理装置が自律的に、NTPサーバ300からの時刻情報に基づいてシステム時刻を少しずつ早めたり、遅らせたりすることで、NTPサーバ300の時刻に合わせることができる。また、その際、時刻同期によって、情報処理装置301内のタスク間の時間関係に矛盾が生じないようにシステム時刻の調整を行うことができる。 Further, in recent computing environments, there are an increasing number of situations in which a plurality of information processing devices are connected to a network and a plurality of systems are required to be operated in cooperation with each other. In such a system, it is necessary to match the system time of each information processing device, but if the time is changed momentarily based on the time information acquired from the NTP server during system operation, the time between operating systems and tasks The relationship can be reversed. On the other hand, according to the 1 μs counter (1 μs counter generation unit 200) provided by the first embodiment and the second embodiment, each information processing device autonomously operates based on the time information from the NTP server 300. By gradually advancing or delaying the system time, it is possible to adjust to the time of the NTP server 300. At that time, the system time can be adjusted so that the time relationship between the tasks in the information processing apparatus 301 does not conflict with each other by time synchronization.

図7は、本発明の一実施形態におけるカウンタ装置の最小構成を示す図である。
図7に示すようにカウンタ装置100は、少なくとも第1カウンタ生成部101と、第2カウンタ変換部102と、換算係数算出部103を備える。
第1カウンタ生成部101は、CPUのクロックに同期して動作するCPUクロックカウンタのカウント値に換算係数を乗じて、特定の周期で動作する第1カウンタによる第1カウント値を算出する。
第2カウンタ変換部102は、時刻情報を、前記特定の周期で動作する第2カウンタによる第2カウント値に変換する。
換算係数算出部103は、第1カウント値と第2カウント値の差分の経時的変動が所定の範囲内となるように、換算係数を調整する。
上記の第一実施形態、第二実施形態の構成と対比すると、第1カウンタ生成部101は1μ秒カウンタ生成部200に対応し、第2カウンタ変換部102は1μ秒カウンタ変換部203に対応し、換算係数算出部103は換算係数算出部205に対応する。
一つの実施形態では、第1カウンタ生成部101のカウント値から第2カウンタ変換部102のカウント値を減じた差分値について、システム起動時における差分値Tc0と、システム起動後所定時間経過してからの差分値Tcxとの差が所定の範囲内に収まらない場合、換算係数算出部103は、その差が正である場合は第1カウンタ生成部101が進んでいると判断し、第1カウンタ生成部101のカウントを遅らせるように、換算係数を算出する。また差が負である場合は、第1カウンタ生成部101が遅れていると判断し、第1カウンタ生成部101のカウントを進めるように換算係数を算出する。
FIG. 7 is a diagram showing a minimum configuration of a counter device according to an embodiment of the present invention.
As shown in FIG. 7, the counter device 100 includes at least a first counter generation unit 101, a second counter conversion unit 102, and a conversion coefficient calculation unit 103.
The first counter generation unit 101 multiplies the count value of the CPU clock counter that operates in synchronization with the CPU clock by a conversion coefficient to calculate the first count value by the first counter that operates in a specific cycle.
The second counter conversion unit 102 converts the time information into a second count value by the second counter that operates in the specific cycle.
The conversion coefficient calculation unit 103 adjusts the conversion coefficient so that the time-dependent fluctuation of the difference between the first count value and the second count value is within a predetermined range.
Compared with the configurations of the first embodiment and the second embodiment, the first counter generation unit 101 corresponds to the 1 μs counter generation unit 200, and the second counter conversion unit 102 corresponds to the 1 μs counter conversion unit 203. , The conversion coefficient calculation unit 103 corresponds to the conversion coefficient calculation unit 205.
In one embodiment, the difference value obtained by subtracting the count value of the second counter conversion unit 102 from the count value of the first counter generation unit 101 is the difference value Tc0 at the time of system startup and after a predetermined time has elapsed after system startup. If the difference from the difference value Tcx of is not within a predetermined range, the conversion coefficient calculation unit 103 determines that the first counter generation unit 101 is advancing if the difference is positive, and generates the first counter. The conversion coefficient is calculated so as to delay the count of the unit 101. If the difference is negative, it is determined that the first counter generation unit 101 is delayed, and the conversion coefficient is calculated so as to advance the count of the first counter generation unit 101.

図8は、本発明の一実施形態における情報処理装置のハードウェア構成の一例を示す図である。
コンピュータ900は、CPU901、主記憶装置902、補助記憶装置903、入出力インタフェース904、通信インタフェース905を備える。上述の情報処理装置301,301aは、コンピュータ900に実装される。そして、上述した1μ秒カウンタ生成部200、カレンダ時刻変換部201、NTP時刻取得部202、NTP時刻取得部202、1μ秒カウンタ変換部203、カウント値比較部204、換算係数算出部205、設定時刻取得部206、事前換算係数算出部400、時刻同期異常検出部401、換算係数切り替え部402、換算係数保持部403の各機能は、プログラムの形式で補助記憶装置903に記憶されている。CPU901は、プログラムを補助記憶装置903から読み出して主記憶装置902に展開し、当該プログラムに従って上記処理を実行する。また、CPU901は、プログラムに従って、記憶領域を主記憶装置902に確保する。また、CPU901は、プログラムに従って、処理中のデータを記憶する記憶領域を補助記憶装置903に確保する。
FIG. 8 is a diagram showing an example of the hardware configuration of the information processing apparatus according to the embodiment of the present invention.
The computer 900 includes a CPU 901, a main storage device 902, an auxiliary storage device 903, an input / output interface 904, and a communication interface 905. The information processing devices 301 and 301a described above are mounted on the computer 900. Then, the above-mentioned 1 μs counter generation unit 200, calendar time conversion unit 201, NTP time acquisition unit 202, NTP time acquisition unit 202, 1 μs counter conversion unit 203, count value comparison unit 204, conversion coefficient calculation unit 205, set time. Each function of the acquisition unit 206, the pre-conversion coefficient calculation unit 400, the time synchronization abnormality detection unit 401, the conversion coefficient switching unit 402, and the conversion coefficient holding unit 403 is stored in the auxiliary storage device 903 in the form of a program. The CPU 901 reads the program from the auxiliary storage device 903, expands it to the main storage device 902, and executes the above processing according to the program. Further, the CPU 901 secures a storage area in the main storage device 902 according to the program. Further, the CPU 901 secures a storage area for storing the data being processed in the auxiliary storage device 903 according to the program.

なお、少なくとも1つの実施形態において、補助記憶装置903は、一時的でない有形の媒体の一例である。一時的でない有形の媒体の他の例としては、入出力インタフェース904を介して接続される磁気ディスク、光磁気ディスク、CD−ROM、DVD−ROM、半導体メモリ等が挙げられる。また、このプログラムが通信回線によってコンピュータ900に配信される場合、配信を受けたコンピュータ900が当該プログラムを主記憶装置902に展開し、上記処理を実行しても良い。また、当該プログラムは、前述した機能の一部を実現するためのものであっても良い。さらに、当該プログラムは、前述した機能を補助記憶装置903に既に記憶されている他のプログラムとの組み合わせで実現するもの、いわゆる差分ファイル(差分プログラム)であっても良い。 In at least one embodiment, the auxiliary storage device 903 is an example of a non-temporary tangible medium. Other examples of non-temporary tangible media include magnetic disks, magneto-optical disks, CD-ROMs, DVD-ROMs, semiconductor memories, etc., which are connected via the input / output interface 904. When this program is distributed to the computer 900 via a communication line, the distributed computer 900 may expand the program to the main storage device 902 and execute the above processing. Further, the program may be for realizing a part of the above-mentioned functions. Further, the program may be a so-called difference file (difference program) that realizes the above-mentioned function in combination with another program already stored in the auxiliary storage device 903.

その他、本発明の趣旨を逸脱しない範囲で、上記した実施の形態における構成要素を周知の構成要素に置き換えることは適宜可能である。また、この発明の技術範囲は上記の実施形態に限られるものではなく、本発明の趣旨を逸脱しない範囲において種々の変更を加えることが可能である。
例えば、実施形態では、カウンタの周期を1μ秒としたが、他の周期でもよい。
In addition, it is possible to replace the components in the above-described embodiment with well-known components as appropriate without departing from the spirit of the present invention. Further, the technical scope of the present invention is not limited to the above-described embodiment, and various modifications can be made without departing from the spirit of the present invention.
For example, in the embodiment, the period of the counter is set to 1 μsec, but other periods may be used.

10・・・CPUクロックカウンタ
200・・・1μ秒カウンタ生成部
201・・・カレンダ時刻変換部
202・・・NTP時刻取得部
203・・・1μ秒カウンタ変換部
204・・・カウント値比較部
205・・・換算係数算出部
206・・・設定時刻取得部
300・・・NTPサーバ
301、301a・・・情報処理装置
400・・・事前換算係数算出部
401・・・時刻同期異常検出部
402・・・換算係数切り替え部
403・・・換算係数保持部
10 ... CPU clock counter 200 ... 1 μs counter generation unit 201 ... Calendar time conversion unit 202 ... NTP time acquisition unit 203 ... 1 μs counter conversion unit 204 ... Count value comparison unit 205・ ・ ・ Conversion coefficient calculation unit 206 ・ ・ ・ Set time acquisition unit 300 ・ ・ ・ NTP server 301, 301a ・ ・ ・ Information processing device 400 ・ ・ ・ Pre-conversion coefficient calculation unit 401 ・ ・ ・ Time synchronization abnormality detection unit 402 ・・ ・ Conversion coefficient switching unit 403 ・ ・ ・ Conversion coefficient holding unit

Claims (10)

CPUのクロックに同期して動作するCPUクロックカウンタのカウント値に換算係数を乗じて、特定の周期で動作する第1カウンタによる第1カウント値を算出する第1カウンタ生成部と、
時刻情報を、前記特定の周期で動作する第2カウンタによる第2カウント値に変換する第2カウンタ変換部と、
前記第1カウント値と前記第2カウント値の差分が所定の閾値以上となった場合に、前記差分が現在よりも小さくなり、且つ、前記第1カウンタが所定時間に算出する前記第1カウント値の前記換算係数の調整による変動が所定の範囲内となるように、前記換算係数を調整する換算係数算出部と、
を備えるカウンタ装置。
A first counter generator that calculates the first count value by the first counter that operates in a specific cycle by multiplying the count value of the CPU clock counter that operates in synchronization with the CPU clock by a conversion coefficient.
A second counter conversion unit that converts time information into a second count value by a second counter that operates in the specific cycle.
When the difference between the first count value and the second count value becomes equal to or greater than a predetermined threshold value, the difference becomes smaller than the present value, and the first count value calculated by the first counter at a predetermined time. A conversion coefficient calculation unit that adjusts the conversion coefficient so that the fluctuation due to the adjustment of the conversion coefficient is within a predetermined range.
A counter device comprising.
前記換算係数算出部は、所定のタイミングにおける前記差分である初期差分値を基準として、その後の前記差分が、前記初期差分値より所定の閾値以上乖離すると前記換算係数を更新する、
請求項1に記載のカウンタ装置。
The conversion coefficient calculation unit updates the conversion coefficient when the subsequent difference deviates from the initial difference value by a predetermined threshold value or more based on the initial difference value which is the difference at a predetermined timing.
The counter device according to claim 1.
前記差分が前記初期差分値より所定の閾値以上乖離した場合であって、前記差分が、前記初期差分値より小さい場合、
前記換算係数算出部は、前記換算係数の値をより大きな値に更新する、
請求項2に記載のカウンタ装置。
When the difference deviates from the initial difference value by a predetermined threshold value or more and the difference is smaller than the initial difference value.
The conversion coefficient calculation unit updates the value of the conversion coefficient to a larger value.
The counter device according to claim 2.
前記差分が前記初期差分値より所定の閾値以上乖離した場合であって、前記差分が、前記初期差分値より大きい場合、
前記換算係数算出部は、前記換算係数の値をより小さな値に更新する、
請求項2から請求項3の何れか1項に記載のカウンタ装置。
When the difference deviates from the initial difference value by a predetermined threshold value or more and the difference is larger than the initial difference value.
The conversion coefficient calculation unit updates the value of the conversion coefficient to a smaller value.
The counter device according to any one of claims 2 to 3.
前記時刻情報を外部の装置から取得する場合に、前記時刻情報の取得における障害を検出する障害検出部と、
前記障害検出部が障害を検出した場合に、前記CPUクロックカウンタのカウント値に乗じる第2の換算係数を、前記障害が検出されない間の複数の時刻に計測した前記CPUクロックカウンタのカウント値および前記第2カウント値に基づいて算出する事前換算係数算出部と、
をさらに備える請求項1から請求項4の何れか1項に記載のカウンタ装置。
When the time information is acquired from an external device, a failure detection unit that detects a failure in the acquisition of the time information, and a failure detection unit.
When the failure detection unit detects a failure, the second conversion coefficient to be multiplied by the count value of the CPU clock counter is measured at a plurality of times while the failure is not detected, and the count value of the CPU clock counter and the said. Pre-conversion coefficient calculation unit that calculates based on the second count value,
The counter device according to any one of claims 1 to 4, further comprising.
請求項1から請求項5の何れか1項に記載のカウンタ装置と、
前記第1カウント値をカレンダ時刻に変換するカレンダ時刻変換部と、
を備える時刻算出装置。
The counter device according to any one of claims 1 to 5.
A calendar time conversion unit that converts the first count value into a calendar time,
Time calculating device when Ru equipped with.
請求項1から請求項5の何れか1項に記載のカウンタ装置と、
NTPサーバから時刻情報を取得するNTP時刻取得部と、
を備える情報処理装置。
The counter device according to any one of claims 1 to 5.
The NTP time acquisition unit that acquires time information from the NTP server,
Information processing device equipped with.
CPUのクロックに同期して動作するCPUクロックカウンタに基づいて動作する第1カウンタの制御方法であって、
前記CPUクロックカウンタのカウント値に換算係数を乗じて、特定の周期で動作する前記第1カウンタによる第1カウント値を算出するステップと、
時刻情報を、前記特定の周期で動作する第2カウンタによる第2カウント値に変換するステップと、
前記第1カウント値と前記第2カウント値の差分が所定の閾値以上となった場合に、前記差分が現在よりも小さくなり、且つ、前記第1カウンタが所定時間に算出する前記第1カウント値の前記換算係数の調整による変動が所定の範囲内となるように、前記換算係数を調整するステップと、
を有する制御方法。
It is a control method of a first counter that operates based on a CPU clock counter that operates in synchronization with the CPU clock.
A step of multiplying the count value of the CPU clock counter by a conversion coefficient to calculate a first count value by the first counter that operates in a specific cycle.
A step of converting time information into a second count value by a second counter operating in the specific cycle, and
When the difference between the first count value and the second count value becomes equal to or greater than a predetermined threshold value, the difference becomes smaller than the present value, and the first count value calculated by the first counter at a predetermined time. The step of adjusting the conversion coefficient and the step of adjusting the conversion coefficient so that the fluctuation due to the adjustment of the conversion coefficient is within a predetermined range.
Control method having.
請求項8に記載の制御方法で前記第1カウンタを制御し、
前記第1カウント値に基づいてカレンダ時刻を算出する、
時刻の算出方法。
The first counter is controlled by the control method according to claim 8.
The calendar time is calculated based on the first count value.
How to calculate the time.
コンピュータを、
CPUのクロックに同期して動作するCPUクロックカウンタのカウント値に換算係数を乗じて、特定の周期で動作する第1カウンタによる第1カウント値を算出する手段、
時刻情報を、前記特定の周期で動作する第2カウンタによる第2カウント値に変換する手段、
前記第1カウント値と前記第2カウント値の差分が所定の閾値以上となった場合に、前記差分が現在よりも小さくなり、且つ、前記第1カウンタが所定時間に算出する前記第1カウント値の前記換算係数の調整による変動が所定の範囲内となるように、前記換算係数を調整する手段、
として機能させるためのプログラム。
Computer,
A means for calculating the first count value by the first counter that operates in a specific cycle by multiplying the count value of the CPU clock counter that operates in synchronization with the CPU clock by a conversion coefficient.
A means for converting time information into a second count value by a second counter operating in the specific cycle.
When the difference between the first count value and the second count value becomes equal to or greater than a predetermined threshold value, the difference becomes smaller than the present value, and the first count value calculated by the first counter at a predetermined time. A means for adjusting the conversion coefficient so that the fluctuation due to the adjustment of the conversion coefficient is within a predetermined range.
A program to function as.
JP2019044609A 2019-03-12 2019-03-12 Counter device, time calculation device, information processing device, control method, time calculation method and program Active JP6951019B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2019044609A JP6951019B2 (en) 2019-03-12 2019-03-12 Counter device, time calculation device, information processing device, control method, time calculation method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019044609A JP6951019B2 (en) 2019-03-12 2019-03-12 Counter device, time calculation device, information processing device, control method, time calculation method and program

Publications (2)

Publication Number Publication Date
JP2020150356A JP2020150356A (en) 2020-09-17
JP6951019B2 true JP6951019B2 (en) 2021-10-20

Family

ID=72430808

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019044609A Active JP6951019B2 (en) 2019-03-12 2019-03-12 Counter device, time calculation device, information processing device, control method, time calculation method and program

Country Status (1)

Country Link
JP (1) JP6951019B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114499732B (en) * 2022-02-09 2023-11-17 中央广播电视总台 Clock calibration method, clock calibration device, computer equipment and readable storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4037069B2 (en) * 2001-07-16 2008-01-23 シチズンホールディングス株式会社 Information portable terminal
JP2003207586A (en) * 2002-01-16 2003-07-25 Seiko Epson Corp Electronic device and its internal time information control method
JP2005283278A (en) * 2004-03-29 2005-10-13 Toshiba Elevator Co Ltd Information display system
CN102119380B (en) * 2009-06-10 2014-04-02 松下电器产业株式会社 Trace processing device and trace processing system
JP5783017B2 (en) * 2011-12-02 2015-09-24 富士通株式会社 Oscillator frequency error correction apparatus, frequency error correction method, frequency error correction program, and frequency error correction system
JP2014127982A (en) * 2012-12-27 2014-07-07 Nec Saitama Ltd Frequency deviation detection system, frequency deviation detection device, and frequency deviation detection method
US10244497B2 (en) * 2014-02-28 2019-03-26 Telefonaktiebolaget Lm Ericsson (Publ) Clock synchronization with hysteresis state switching
JP2018098711A (en) * 2016-12-15 2018-06-21 日本電信電話株式会社 Time synchronization system, client terminal device, time synchronization method, and time synchronization program

Also Published As

Publication number Publication date
JP2020150356A (en) 2020-09-17

Similar Documents

Publication Publication Date Title
US11316605B2 (en) Method, device, and computer program for improving synchronization of clocks in devices linked according to a daisy-chain topology
EP2369438B1 (en) Calibration method of a real time clock signal
US10594424B2 (en) Time synchronization slave apparatus capable of adjusting time synchronization period, and method of determining time synchronization period
US11303376B2 (en) Information processing apparatus and time synchronization method
US11853116B2 (en) Clock error-bound tracker
US11310026B2 (en) Communication system, communication device, and program
US11689350B2 (en) Synchronization between devices for PWM waveforms
JP6951019B2 (en) Counter device, time calculation device, information processing device, control method, time calculation method and program
US20100198363A1 (en) Distributed control system
US12216489B2 (en) Clock adjustment holdover
US11137794B2 (en) Systems and methods for synchronization of multiple processors
JP2007251925A (en) Clock generation circuit
US11664969B2 (en) Communication apparatus, method of controlling communication apparatus, and storage medium
JP6581254B1 (en) Clock adjustment apparatus and program
JP7382980B2 (en) Controller, equipment control system, time synchronization method, and time synchronization program
JP4651988B2 (en) Clock accuracy correction device
CN117424668A (en) Time synchronization between master and slave devices in a network
US20180373495A1 (en) Method and apparatus for controlling an average fill level of an asynchronous first-in-first-out, fifo
JP2023122681A (en) Reference pulse correction device and reference pulse correction method
JP4616054B2 (en) Measuring system
US9746876B2 (en) Drift compensation for a real time clock circuit
US12413803B2 (en) Reproduction device, time correction method, and program
JP2020031334A (en) Clock synchronization system and clock synchronization method
WO2025191852A1 (en) Motor control device
CN105323057B (en) Clock synchronization method of IRIG106 system

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20200707

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20210420

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20210601

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20210707

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20210824

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20210916

R150 Certificate of patent or registration of utility model

Ref document number: 6951019

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150