Obtaining a Unix Timestamp in Go Language (current time in seconds since epoch)
If you want it as string
just convert it via strconv
:
package main
import (
"fmt"
"strconv"
"time"
)
func main() {
timestamp := strconv.FormatInt(time.Now().UTC().UnixNano(), 10)
fmt.Println(timestamp) // prints: 1436773875771421417
}
import "time"
...
port[5] = time.Now().Unix()