FAQ
http://play.golang.org/p/IegjQw6PpS

package main

import "fmt"
import "time"
import "log"

func outputTime(s0, s1 string) error {
const format = "15:04:05.000000"
t0, err := time.Parse(format, s0)
if err != nil {
log.Println(err)
return err
}
t1, err := time.Parse(format, s0)
if err != nil {
log.Println(err)
return err
}
du := t1.Sub(t0)
fmt.Println("Duration=", du)
fmt.Println(s0, s1, "=", t0, t1, du.Nanoseconds())
return nil
}
func main() {
outputTime("16:46:29.014915","16:46:29.016539")
}


--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Jan Mercl at May 24, 2013 at 10:01 am

    On Fri, May 24, 2013 at 11:58 AM, dlin wrote:
    http://play.golang.org/p/IegjQw6PpS
    http://play.golang.org/p/6VCaTzy13l

    -j

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Dlin at May 24, 2013 at 10:06 am
    I'm shame. It is my "copy & paste" error.
    On Friday, May 24, 2013 5:58:21 PM UTC+8, dlin wrote:

    http://play.golang.org/p/IegjQw6PpS

    package main

    import "fmt"
    import "time"
    import "log"

    func outputTime(s0, s1 string) error {
    const format = "15:04:05.000000"
    t0, err := time.Parse(format, s0)
    if err != nil {
    log.Println(err)
    return err
    }
    t1, err := time.Parse(format, s0)
    if err != nil {
    log.Println(err)
    return err
    }
    du := t1.Sub(t0)
    fmt.Println("Duration=", du)
    fmt.Println(s0, s1, "=", t0, t1, du.Nanoseconds())
    return nil
    }
    func main() {
    outputTime("16:46:29.014915","16:46:29.016539")
    }

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMay 24, '13 at 9:58a
activeMay 24, '13 at 10:06a
posts3
users2
websitegolang.org

2 users in discussion

Dlin: 2 posts Jan Mercl: 1 post

People

Translate

site design / logo © 2022 Grokbase