all tasks
This commit is contained in:
parent
b83f433714
commit
68f8f3e56b
14735 changed files with 178959 additions and 0 deletions
25
Task/Time-a-function/Go/time-a-function-3.go
Normal file
25
Task/Time-a-function/Go/time-a-function-3.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
func from(t0 time.Time) {
|
||||
fmt.Println(time.Now().Sub(t0))
|
||||
}
|
||||
|
||||
func empty() {
|
||||
defer from(time.Now())
|
||||
}
|
||||
|
||||
func count() {
|
||||
defer from(time.Now())
|
||||
for i := 0; i < 1e6; i++ {
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
empty()
|
||||
count()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue