mirror of
https://github.com/status-im/simulation.git
synced 2025-02-24 12:58:11 +00:00
29 lines
540 B
Go
29 lines
540 B
Go
package whisperv6
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
// logEntry defines the reporting log entry for one
|
|
// p2p message sending.
|
|
type logEntry struct {
|
|
From int
|
|
To int
|
|
Ts time.Duration
|
|
}
|
|
|
|
// String implements Stringer interface for logEntry.
|
|
func (l logEntry) String() string {
|
|
return fmt.Sprintf("%s: %d -> %d", l.Ts.String(), l.From, l.To)
|
|
}
|
|
|
|
// newlogEntry creates new log entry.
|
|
func newlogEntry(start time.Time, from, to int) *logEntry {
|
|
return &logEntry{
|
|
Ts: time.Since(start) / time.Millisecond,
|
|
From: from,
|
|
To: to,
|
|
}
|
|
}
|