Re: [go-nuts] golang time.Duration calculation

2016-07-07 Thread Jakob Borg
Or, as an alternative, use the built in methods to get seconds in floating point: https://play.golang.org/p/euWSlfDf3Y //jb 2016-07-07 0:20 GMT+02:00 Dan Kortschak : > Type convert *prior* to the division. > > https://play.golang.org/p/7cwTFu_3im > > On Wed, 2016-07-06 at 15:01 -0700, Tong Sun w

Re: [go-nuts] golang time.Duration calculation

2016-07-06 Thread Dan Kortschak
Type convert *prior* to the division. https://play.golang.org/p/7cwTFu_3im On Wed, 2016-07-06 at 15:01 -0700, Tong Sun wrote: > To make the point, let's use *68 seconds*, > > https://play.golang.org/p/mfuJQa3_65 > > I need the result to be 52.94, instead of 52. -- You received this message

Re: [go-nuts] golang time.Duration calculation

2016-07-06 Thread Tong Sun
To make the point, let's use *68 seconds*, https://play.golang.org/p/mfuJQa3_65 I need the result to be 52.94, instead of 52. On Wednesday, July 6, 2016 at 5:55:18 PM UTC-4, Tong Sun wrote: > > > oh, please make it *65 seconds*, > > https://play.golang.org/p/JiftSjddjx > > I need the float p

Re: [go-nuts] golang time.Duration calculation

2016-07-06 Thread Tong Sun
oh, please make it *65 seconds*, https://play.golang.org/p/JiftSjddjx I need the float point calculations. I.e., I need to result to be 55.38, instead of 55. On Wednesday, July 6, 2016 at 5:53:37 PM UTC-4, Rob 'Commander' Pike wrote: > > Just divide the durations: https://play.golang.org/p/

Re: [go-nuts] golang time.Duration calculation

2016-07-06 Thread Rob Pike
Just divide the durations: https://play.golang.org/p/ILE11eLzSx On Wed, Jul 6, 2016 at 2:43 PM, Tong Sun wrote: > I know golang time.Duration supports basic calculations. but the problem > I'm trying to answer is, > > How many *100 seconds *does *one hour *has? > > This is my code: > https://p

[go-nuts] golang time.Duration calculation

2016-07-06 Thread Tong Sun
I know golang time.Duration supports basic calculations. but the problem I'm trying to answer is, How many *100 seconds *does *one hour *has? This is my code: https://play.golang.org/p/HnwY8pDxL8 It's not fully working. Please help. Thanks -- You received this message because you are subscri