Golang time.Since() function example
package time
Golang time.Since() function usage example
package main
import (
"fmt"
"time"
)
func main() {
start := time.Now() // get current time
// some function
fmt.Println("Hello World!")
elapsed := time.Since(start) //<------------------ here !
fmt.Printf("Print Hello World took %s\n", elapsed)
}
References :
http://golang.org/pkg/time/#Since
https://www.socketloop.com/tutorials/golang-calculate-elapsed-run-time
Advertisement
Something interesting
Tutorials
+12.5k Golang : Forwarding a local port to a remote server example
+9.4k Golang : Detect Pascal, Kebab, Screaming Snake and Camel cases
+7.1k Golang : Array mapping with Interface
+13.9k Golang : convert(cast) string to float value
+6.3k Javascript : Generate random key with specific length
+5.6k PHP : Fix Call to undefined function curl_init() error
+9k Golang : How to use Gorilla webtoolkit context package properly
+7.5k Golang : Rot13 and Rot5 algorithms example
+11.9k Golang : Convert(cast) bigint to string
+14.1k Golang : Check if a file exist or not
+8.8k Golang : HTTP Routing with Goji example