This libaray would be used to get the next working group, which shoud begin to work. This libary used dgram third-party libary to use udp protocoll, in case to send and get message from ntp server.
- Using ntp server pool to uniform unix time
- Every 30s switch to next group, which should to work
Instance a circle object and selected the nearest ntp server based on the timezone
config: config json for instance
Initialize the timestamp, when the first group begin to work. Save the time stamp to attribute this.timeStampOfLastGroup
This API is a aync method to get the next group number after a while
callback: a callback function to get the caculated working group number
This function used to get the time of next group begin to work
This function used to get the time of the next periode
To use the libary to get the next working group, you need to do following steps.
- Select the nearest ntp server
const SECjsCircle =const config =circleTimeOut: 30ntpTryOut: 0timeServer: 'DE'sumOfGroups: 10isMiningHost: truelet secjsCircle = config
- Initialize the time stamp of the circle if the group at the first time begin to work
- Get the next group number, which should begin to work