Commit 0a2baad4 authored by Cranky Kernel's avatar Cranky Kernel

time check: log time in user readable format (in json mode)

parent a66574ad
......@@ -173,18 +173,16 @@ func ServerMain() {
roundTripTime := time.Now().Sub(requestStart)
now := time.Now().UnixNano() / int64(time.Millisecond)
diff := math.Abs(float64(now - response.ServerTime))
logFields := log.Fields{
"roundTripTime": fmt.Sprintf("%v", roundTripTime),
"binanceTimeDifferentMs": fmt.Sprintf("%v", diff),
}
if diff > 999 {
log.WithFields(log.Fields{
"roundTripTime": roundTripTime,
"binanceTimeDifferentMs": diff,
}).Warnf("Time difference from Binance servers may be too large; order may fail")
log.WithFields(logFields).Warnf("Time difference from Binance servers may be too large; order may fail")
clientNotificationService.Broadcast(clientnotificationservice.NewNotice(clientnotificationservice.LevelWarning,
"Time difference between Binance and Maker server too large, orders may fail."))
} else {
log.WithFields(log.Fields{
"roundTripTime": roundTripTime,
"binanceTimeDifferenceMs": diff,
}).Infof("Binance time check")
log.WithFields(logFields).Infof("Binance time check")
}
time.Sleep(1 * time.Minute)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment