mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-07-31 07:43:19 +00:00

* [NOD-1098] Change timestamps to be millisecond precision * [NOD-1098] Change lock times to use milliseconds * [NOD-1098] Use milliseconds precision everywhere * [NOD-1098] Implement type mstime.Time * [NOD-1098] Fix block 100000 timestamp * [NOD-1098] Change orphan child to be one millisecond delay after its parent * [NOD-1098] Remove test that checks if header timestamps have the right precision, and instead add tests for mstime, and fix genesis for testnet and devnet * [NOD-1098] Fix comment * [NOD-1098] Fix comment * [NOD-1098] Fix testnet genesis * [NOD-1098] Rename UnixMilli->UnixMilliseconds
26 lines
595 B
Go
26 lines
595 B
Go
package blockdag
|
|
|
|
import (
|
|
"github.com/kaspanet/kaspad/util/mstime"
|
|
)
|
|
|
|
// TimeSource is the interface to access time.
|
|
type TimeSource interface {
|
|
// Now returns the current time.
|
|
Now() mstime.Time
|
|
}
|
|
|
|
// timeSource provides an implementation of the TimeSource interface
|
|
// that simply returns the current local time.
|
|
type timeSource struct{}
|
|
|
|
// Now returns the current local time, with one millisecond precision.
|
|
func (m *timeSource) Now() mstime.Time {
|
|
return mstime.Now()
|
|
}
|
|
|
|
// NewTimeSource returns a new instance of a TimeSource
|
|
func NewTimeSource() TimeSource {
|
|
return &timeSource{}
|
|
}
|