time
This commit is contained in:
parent
75131afd16
commit
29bce7bb7b
4
td.go
4
td.go
@ -110,6 +110,7 @@ func ListenCW(c *tdlib.Client) {
|
||||
func getHistory(c *tdlib.Client) {
|
||||
var lastMsgID64 int64 = int64(math.MaxInt64)
|
||||
var msgCount int32 = 0
|
||||
var lastMsgTime Time = time.Now()
|
||||
|
||||
fmt.Printf("Retrieving chat.\n")
|
||||
|
||||
@ -142,7 +143,7 @@ func getHistory(c *tdlib.Client) {
|
||||
if err != nil {
|
||||
if err.Error() == "timeout" {
|
||||
logOnError(err, "Waiting...")
|
||||
fmt.Printf("Waiting (%d messages retrieved).\n", msgCount)
|
||||
fmt.Printf("Waiting : %d messages retrieved from %s ...\n", msgCount, lastMsgTime.Format(time.RFC3339))
|
||||
} else {
|
||||
logOnError(err, "Cannot get history")
|
||||
lastMsgID64 = -1
|
||||
@ -176,6 +177,7 @@ func getHistory(c *tdlib.Client) {
|
||||
})
|
||||
if msg.ID < lastMsgID64 {
|
||||
lastMsgID64 = msg.ID
|
||||
lastMsgTime = time.Unix(m.Date, 0)
|
||||
}
|
||||
msgCount = msgCount + 1
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user