Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleAfter (0.12 sec)

  1. src/time/example_test.go

    	m, _ := time.ParseDuration("1m30s")
    	fmt.Printf("Take off in t-%.0f seconds.", m.Seconds())
    	// Output: Take off in t-90 seconds.
    }
    
    var c chan int
    
    func handle(int) {}
    
    func ExampleAfter() {
    	select {
    	case m := <-c:
    		handle(m)
    	case <-time.After(10 * time.Second):
    		fmt.Println("timed out")
    	}
    }
    
    func ExampleSleep() {
    	time.Sleep(100 * time.Millisecond)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Feb 13 01:05:00 UTC 2024
    - 22.4K bytes
    - Viewed (0)
Back to top