Time Elapsed

Python

  1. import time
  2.  
  3. t0 = time.time()
  4. time.sleep(3.5) # for example
  5. t1 = time.time()
  6. print "Took %.2f seconds" % (t1 - t0)

Go

  1. package main
  2.  
  3. import "time"
  4.  
  5. func main() {
  6. t0 := time.Now()
  7. elapsed := time.Since(t0)
  8. fmt.Printf("Took %s", elapsed)
  9. }