From 35649df8958218f4dc42acb833ea39719858b3f8 Mon Sep 17 00:00:00 2001 From: Rajat Kalsy Date: Mon, 14 Jan 2019 18:52:06 +0530 Subject: [PATCH] Fixes for 32 bit --- history_request.go | 2 +- subscription_manager.go | 3 +++ subscription_manager_test.go | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/history_request.go b/history_request.go index 6baad636..8756fd59 100644 --- a/history_request.go +++ b/history_request.go @@ -251,7 +251,7 @@ func parseInterface(vv []interface{}, o *historyOpts) []HistoryResponseItem { s := fmt.Sprintf("%.0f", f) o.pubnub.Config.Log.Println("s:", s) - if tt, err := strconv.Atoi(s); err == nil { + if tt, err := strconv.ParseInt(s, 10, 64); err == nil { o.pubnub.Config.Log.Println("tt:", tt) items[i].Timetoken = int64(tt) } else { diff --git a/subscription_manager.go b/subscription_manager.go index 45878bbf..61c413a6 100644 --- a/subscription_manager.go +++ b/subscription_manager.go @@ -573,6 +573,9 @@ func processSubscribePayload(m *SubscriptionManager, payload subscribeMessage) { case int: timestamp = int64(presencePayload["timestamp"].(int)) break + case int64: + timestamp = presencePayload["timestamp"].(int64) + break case float64: timestamp = int64(presencePayload["timestamp"].(float64)) break diff --git a/subscription_manager_test.go b/subscription_manager_test.go index 68eddb37..7d576cf8 100644 --- a/subscription_manager_test.go +++ b/subscription_manager_test.go @@ -403,7 +403,7 @@ func TestProcessSubscribePayload(t *testing.T) { payload := &map[string]interface{}{ "action": "join", - "timestamp": 15078947309567840, + "timestamp": int64(15078947309567840), "uuid": "bfce00ff4018fce180438bb04afc8da8", "occupancy": 1, } @@ -504,7 +504,7 @@ func TestProcessSubscribePayloadSubMatch(t *testing.T) { payload := &map[string]interface{}{ "action": "join", - "timestamp": 15078947309567840, + "timestamp": int64(15078947309567840), "uuid": "bfce00ff4018fce180438bb04afc8da8", "occupancy": 1, "here_now_refresh": true,