package response

import (
	"encoding/json"
	"time"
)

type Timestamp int64

type baseResponse struct {
	Command   string
	Timestamp Timestamp
}

func (t *Timestamp) MarshalJSON() ([]byte, error) {
	return json.Marshal(time.Now().UnixNano() / 1e6)
}

func Send(r interface{}, sender func([]byte)) error {
	serialized, err := json.Marshal(r)
	if err == nil {
		sender(serialized)
	}
	return err
}

package response

import (
	"encoding/json"
	"time"
)

type Response interface {
	MakeATimestamp()
}

type baseResponse struct {
	Command   string
	Timestamp int64
}

func (r *baseResponse) MakeATimestamp() {
	r.Timestamp = time.Now().UnixNano() / 1e6
}

func Send(r Response, sender func([]byte)) error {
	r.MakeATimestamp()
	serialized, err := json.Marshal(r)
	if err == nil {
		sender(serialized)
	}
	return err
}

--- 
+++ 
@@ -5,21 +5,18 @@
 	"time"
 )
 
-type Response interface {
-	MakeATimestamp()
-}
+type Timestamp int64
 
 type baseResponse struct {
 	Command   string
-	Timestamp int64
+	Timestamp Timestamp
 }
 
-func (r *baseResponse) MakeATimestamp() {
-	r.Timestamp = time.Now().UnixNano() / 1e6
+func (t *Timestamp) MarshalJSON() ([]byte, error) {
+	return json.Marshal(time.Now().UnixNano() / 1e6)
 }
 
-func Send(r Response, sender func([]byte)) error {
-	r.MakeATimestamp()
+func Send(r interface{}, sender func([]byte)) error {
 	serialized, err := json.Marshal(r)
 	if err == nil {
 		sender(serialized)
Fix the marshaling of timestamp in response
