Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(216)

Issue 5696078: code review 5696078: time: add a comment about how to use the Duration constants (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
13 years, 9 months ago by r
Modified:
13 years, 9 months ago
CC:
golang-dev, bradfitz, r2
Visibility:
Public.

Description

time: add a comment about how to use the Duration constants

Patch Set 1 #

Patch Set 2 : diff -r 81084c0ed4e8 https://code.google.com/p/go/ #

Patch Set 3 : diff -r 81084c0ed4e8 https://code.google.com/p/go/ #

Patch Set 4 : diff -r 81084c0ed4e8 https://code.google.com/p/go/ #

Patch Set 5 : diff -r 81084c0ed4e8 https://code.google.com/p/go/ #

Total comments: 3

Patch Set 6 : diff -r 81084c0ed4e8 https://code.google.com/p/go/ #

Patch Set 7 : diff -r 767b6229d4dc https://code.google.com/p/go/ #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+9 lines, -0 lines) Patch
M src/pkg/time/time.go View 1 2 3 4 5 1 chunk +9 lines, -0 lines 3 comments Download

Messages

Total messages: 17
r
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://code.google.com/p/go/
13 years, 9 months ago (2012-02-26 08:59:19 UTC) #1
bradfitz
Feels weird to write docs assuming the author is already in package "time". I'd qualify ...
13 years, 9 months ago (2012-02-26 09:10:04 UTC) #2
r
Hello golang-dev@googlegroups.com, bradfitz@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 9 months ago (2012-02-26 09:23:31 UTC) #3
r2
On 26/02/2012, at 8:10 PM, Brad Fitzpatrick wrote: > Feels weird to write docs assuming ...
13 years, 9 months ago (2012-02-26 09:23:50 UTC) #4
dsymonds
You'd never write time.Duration(time.Second); time.Second is already that type.
13 years, 9 months ago (2012-02-26 10:34:35 UTC) #5
r2
sigh.
13 years, 9 months ago (2012-02-26 11:19:06 UTC) #6
r
Hello golang-dev@googlegroups.com, bradfitz@golang.org, r@google.com, dsymonds@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 9 months ago (2012-02-26 11:19:38 UTC) #7
bradfitz
http://codereview.appspot.com/5696078/diff/6/src/pkg/time/time.go File src/pkg/time/time.go (right): http://codereview.appspot.com/5696078/diff/6/src/pkg/time/time.go#newcode389 src/pkg/time/time.go:389: // second := time.Second "time." here http://codereview.appspot.com/5696078/diff/6/src/pkg/time/time.go#newcode390 src/pkg/time/time.go:390: // ...
13 years, 9 months ago (2012-02-26 11:21:09 UTC) #8
r
Hello golang-dev@googlegroups.com, bradfitz@golang.org, r@google.com, dsymonds@golang.org (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 9 months ago (2012-02-26 11:21:57 UTC) #9
bradfitz
LGTM
13 years, 9 months ago (2012-02-26 11:23:54 UTC) #10
r2
i wrote them, compiled them, ran them, took out the times, mailed them. you said ...
13 years, 9 months ago (2012-02-26 11:24:10 UTC) #11
r
*** Submitted as http://code.google.com/p/go/source/detail?r=84582b0431a1 *** time: add a comment about how to use the Duration ...
13 years, 9 months ago (2012-02-26 11:24:56 UTC) #12
dsymonds
LGTM
13 years, 9 months ago (2012-02-26 12:00:47 UTC) #13
crawshaw1
http://codereview.appspot.com/5696078/diff/7002/src/pkg/time/time.go File src/pkg/time/time.go (right): http://codereview.appspot.com/5696078/diff/7002/src/pkg/time/time.go#newcode394 src/pkg/time/time.go:394: // fmt.Print(time.Duration(seconds)*time.Second) // prints 10s equivalent: s/time.Duration(seconds)/seconds/
13 years, 9 months ago (2012-02-26 14:21:27 UTC) #14
bradfitzgoog
http://codereview.appspot.com/5696078/diff/7002/src/pkg/time/time.go File src/pkg/time/time.go (right): http://codereview.appspot.com/5696078/diff/7002/src/pkg/time/time.go#newcode394 src/pkg/time/time.go:394: // fmt.Print(time.Duration(seconds)*time.Second) // prints 10s On 2012/02/26 14:21:27, crawshaw1 ...
13 years, 9 months ago (2012-02-26 14:22:52 UTC) #15
bradfitzgoog
http://codereview.appspot.com/5696078/diff/7002/src/pkg/time/time.go File src/pkg/time/time.go (right): http://codereview.appspot.com/5696078/diff/7002/src/pkg/time/time.go#newcode394 src/pkg/time/time.go:394: // fmt.Print(time.Duration(seconds)*time.Second) // prints 10s On 2012/02/26 14:22:53, bradfitzgoog ...
13 years, 9 months ago (2012-02-26 14:25:57 UTC) #16
crawshaw1
13 years, 9 months ago (2012-02-26 14:54:56 UTC) #17
On Sun, Feb 26, 2012 at 9:25 AM,  <bradfitz@google.com> wrote:
>
> http://codereview.appspot.com/5696078/diff/7002/src/pkg/time/time.go
> File src/pkg/time/time.go (right):
>
>
http://codereview.appspot.com/5696078/diff/7002/src/pkg/time/time.go#newcode394
> src/pkg/time/time.go:394:
> //      fmt.Print(time.Duration(seconds)*time.Second) // prints 10s
> On 2012/02/26 14:22:53, bradfitzgoog wrote:
>>
>> On 2012/02/26 14:21:27, crawshaw1 wrote:
>> > equivalent: s/time.Duration(seconds)/seconds/
>
>
>> That's not the idiom, though.
>
>
> Not to mention your "equivalent" way wouldn't even compile (an int * an
> time.Duration). But even if "secs" were a constant (not an int, as
> above), it still wouldn't be the idiom.  We always write:
>
> time.Duration(identifier) * time.Unit
>
> And we tend to even include 1 when doing something like:
>
> 1 * time.Minute
>
> http://codereview.appspot.com/5696078/

Ah you're right, I took the easy but very different shortcut when
testing, 10*time.Second. I'll be quiet now.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b