Browse Source

:gear: use UTC

Ettore Di Giacinto 3 years ago
parent
commit
f9010ce2ed
3 changed files with 5 additions and 5 deletions
  1. 2 2
      api/client/service/service.go
  2. 1 1
      pkg/blockchain/block.go
  3. 2 2
      pkg/services/alive.go

+ 2 - 2
api/client/service/service.go

@@ -56,7 +56,7 @@ type advertizeMessage struct {
 
 
 // Advertize advertize the given uuid to the ledger
 // Advertize advertize the given uuid to the ledger
 func (c Client) Advertize(uuid string) error {
 func (c Client) Advertize(uuid string) error {
-	return c.Client.Put(c.serviceID, fmt.Sprintf("%s-uuid", uuid), advertizeMessage{Time: time.Now()})
+	return c.Client.Put(c.serviceID, fmt.Sprintf("%s-uuid", uuid), advertizeMessage{Time: time.Now().UTC()})
 }
 }
 
 
 // ActiveNodes returns a list of active nodes
 // ActiveNodes returns a list of active nodes
@@ -73,7 +73,7 @@ func (c Client) ActiveNodes() (active []string, err error) {
 		}
 		}
 		res.Unmarshal(&d)
 		res.Unmarshal(&d)
 
 
-		if d.Time.Add(2 * time.Minute).After(time.Now()) {
+		if d.Time.Add(2 * time.Minute).After(time.Now().UTC()) {
 			active = append(active, u)
 			active = append(active, u)
 		}
 		}
 	}
 	}

+ 1 - 1
pkg/blockchain/block.go

@@ -66,7 +66,7 @@ func (b Block) Checksum() string {
 func (oldBlock Block) NewBlock(s map[string]map[string]Data) Block {
 func (oldBlock Block) NewBlock(s map[string]map[string]Data) Block {
 	var newBlock Block
 	var newBlock Block
 
 
-	t := time.Now()
+	t := time.Now().UTC()
 
 
 	newBlock.Index = oldBlock.Index + 1
 	newBlock.Index = oldBlock.Index + 1
 	newBlock.Timestamp = t.String()
 	newBlock.Timestamp = t.String()

+ 2 - 2
pkg/services/alive.go

@@ -36,7 +36,7 @@ func AliveNetworkService(announcetime, scrubTime, maxtime time.Duration) node.Ne
 			func() {
 			func() {
 				// Keep-alive
 				// Keep-alive
 				b.Add(protocol.HealthCheckKey, map[string]interface{}{
 				b.Add(protocol.HealthCheckKey, map[string]interface{}{
-					n.Host().ID().String(): time.Now().Format(time.RFC3339),
+					n.Host().ID().String(): time.Now().UTC().Format(time.RFC3339),
 				})
 				})
 
 
 				// Keep-alive scrub
 				// Keep-alive scrub
@@ -75,7 +75,7 @@ func AvailableNodes(b *blockchain.Ledger, maxTime time.Duration) (active []strin
 		var s string
 		var s string
 		t.Unmarshal(&s)
 		t.Unmarshal(&s)
 		parsed, _ := time.Parse(time.RFC3339, s)
 		parsed, _ := time.Parse(time.RFC3339, s)
-		if parsed.Add(maxTime).After(time.Now()) {
+		if parsed.Add(maxTime).After(time.Now().UTC()) {
 			active = append(active, u)
 			active = append(active, u)
 		}
 		}
 	}
 	}