package main
import (
"fmt"
"time"
)
const MAXSLEEP = 128
func main() {
for numsec := 1; numsec <= MAXSLEEP; numsec <<= 1 {
// TODO
if numsec <= MAXSLEEP/2 {
time.Sleep(time.Second * time.Duration(numsec))
fmt.Println("slepp time(s):", numsec)
}
}
}
原文地址:http://blog.51cto.com/13187574/2083963
时间: 2024-11-06 13:25:48