Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateRemainingTime ¶ added in v0.5.0
func EstimateRemainingTime(timeStart time.Time, current int64, total int64) (percentage float64, remaining time.Duration)
EstimateRemainingTime estimates the remaining time for a running operation and returns the finished percentage.
func GetUint32Diff ¶
GetUint32Diff returns the difference between newCount and oldCount and catches overflows
func RandomInsecure ¶
RandomInsecure returns a random int in the range of min to max. the result is not cryptographically secure. RandomInsecure is inclusive max value.
func RandomTrytesInsecure ¶
RandomTrytesInsecure returns random Trytes with the given length. the result is not cryptographically secure. DO NOT USE this function to generate a seed.
Types ¶
type TimeHeap ¶
type TimeHeap struct {
// contains filtered or unexported fields
}
TimeHeap implements a heap sorted by time, where older elements are popped during GetAveragePerSecond call.
func (*TimeHeap) GetAveragePerSecond ¶
GetAveragePerSecond calculates the average per second of all entries in the given duration. older elements are removed from the container.