Go Sleep()

1 개요[ | ]

package main

import (
	"time"
)

func main() {
	time.Sleep(100 * time.Millisecond) // 100ms (=0.1s)
}
package main

import (
	"time"
)

func main() {
	time.Sleep(3000 * time.Millisecond) // 3s
	time.Sleep(3 * time.Second)         // 3s
}
package main

import (
	"fmt"
	"time"
)

func main() {
	start := time.Now()
	time.Sleep(2000 * time.Millisecond) // 2s
	elapsed := time.Now().Sub(start)
	fmt.Println( elapsed ) // 2.001080669s
}

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}