Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

And durations:

    package main
    import "fmt"
    import "time"
    func main() {
            three_secs, _ := time.ParseDuration("3s")
            five := 5
            fmt.Println(five * three_secs) // error: type mismatch
            fmt.Println(three_secs * three_secs) // 2500000h0m0s
    }


Good Lord.

EDIT: Wait, I don't even understand how that can work, even in a broken way. Since I guessed 25000006060=9,000,000,000, I guessed that a "second duration" is really just a wrapper around `3,000` (ms) or `3,000,000` (ns) - but neither of those square to 9E9. In fact, the square root of 9E9 is a distinctly non-round number. What's going on here?




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: