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

Issue 4830065: code review 4830065: time: parse and format fractional seconds (Closed)

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

Description

time: parse and format fractional seconds

Patch Set 1 #

Total comments: 1

Patch Set 2 : diff -r 5cb8323ba43c https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 3 : diff -r 5cb8323ba43c https://go.googlecode.com/hg/ #

Patch Set 4 : diff -r 5cb8323ba43c https://go.googlecode.com/hg/ #

Total comments: 1

Patch Set 5 : diff -r 5cb8323ba43c https://go.googlecode.com/hg/ #

Patch Set 6 : diff -r 5cb8323ba43c https://go.googlecode.com/hg/ #

Patch Set 7 : diff -r 5cb8323ba43c https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r 5cb8323ba43c https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+113 lines, -24 lines) Patch
M src/pkg/time/format.go View 1 2 3 4 5 6 7 7 chunks +65 lines, -1 line 0 comments Download
M src/pkg/time/time_test.go View 1 2 3 4 6 chunks +48 lines, -23 lines 0 comments Download

Messages

Total messages: 18
r
Hello golang-dev@googlegroups.com, I'd like you to review this change to https://go.googlecode.com/hg/
13 years, 9 months ago (2011-08-07 02:05:33 UTC) #1
rog
LGTM http://codereview.appspot.com/4830065/diff/1/src/pkg/time/format.go File src/pkg/time/format.go (right): http://codereview.appspot.com/4830065/diff/1/src/pkg/time/format.go#newcode668 src/pkg/time/format.go:668: t.Nanosecond, err = strconv.Atoi(value[1:len(std)]) Atoui ?
13 years, 9 months ago (2011-08-07 02:52:31 UTC) #2
r2
On 07/08/2011, at 12:52 PM, rogpeppe@gmail.com wrote: > LGTM > > > http://codereview.appspot.com/4830065/diff/1/src/pkg/time/format.go > File ...
13 years, 9 months ago (2011-08-07 02:54:58 UTC) #3
dsymonds
http://codereview.appspot.com/4830065/diff/5001/src/pkg/time/format.go File src/pkg/time/format.go (right): http://codereview.appspot.com/4830065/diff/5001/src/pkg/time/format.go#newcode30 src/pkg/time/format.go:30: // fractional second. only when following seconds? isn't that ...
13 years, 9 months ago (2011-08-07 05:46:06 UTC) #4
r2
On 07/08/2011, at 3:46 PM, dsymonds@golang.org wrote: > > http://codereview.appspot.com/4830065/diff/5001/src/pkg/time/format.go > File src/pkg/time/format.go (right): > ...
13 years, 9 months ago (2011-08-07 05:56:11 UTC) #5
dsymonds
On Sun, Aug 7, 2011 at 3:55 PM, Rob 'Commander' Pike <r@google.com> wrote: > "foo.01.02" ...
13 years, 9 months ago (2011-08-07 06:03:45 UTC) #6
bradfitz
The bug that I and many others have hit is the RFC3339 format. RFC3339 can ...
13 years, 9 months ago (2011-08-07 06:16:38 UTC) #7
fvb
http://codereview.appspot.com/4830065/diff/4003/src/pkg/time/format.go File src/pkg/time/format.go (right): http://codereview.appspot.com/4830065/diff/4003/src/pkg/time/format.go#newcode29 src/pkg/time/format.go:29: // A decimal point followed by one or more ...
13 years, 9 months ago (2011-08-07 06:53:52 UTC) #8
r2
On 07/08/2011, at 4:53 PM, fvbommel@gmail.com wrote: > > http://codereview.appspot.com/4830065/diff/4003/src/pkg/time/format.go > File src/pkg/time/format.go (right): > ...
13 years, 9 months ago (2011-08-07 07:44:19 UTC) #9
r2
On 07/08/2011, at 4:16 PM, bradfitz@golang.org wrote: > The bug that I and many others ...
13 years, 9 months ago (2011-08-07 07:45:35 UTC) #10
r2
On 07/08/2011, at 4:03 PM, David Symonds wrote: > On Sun, Aug 7, 2011 at ...
13 years, 9 months ago (2011-08-07 08:04:31 UTC) #11
r
Hello golang-dev@googlegroups.com, rogpeppe@gmail.com, r@google.com, dsymonds@golang.org, bradfitz@golang.org, fvbommel@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 9 months ago (2011-08-07 08:04:46 UTC) #12
r
Hello golang-dev@googlegroups.com, rogpeppe@gmail.com, r@google.com, dsymonds@golang.org, bradfitz@golang.org, fvbommel@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 9 months ago (2011-08-07 08:06:57 UTC) #13
r
Hello golang-dev@googlegroups.com, rogpeppe@gmail.com, r@google.com, dsymonds@golang.org, bradfitz@golang.org, fvbommel@gmail.com (cc: golang-dev@googlegroups.com), Please take another look.
13 years, 9 months ago (2011-08-07 08:09:16 UTC) #14
dsymonds
LGTM
13 years, 9 months ago (2011-08-07 13:34:10 UTC) #15
r
*** Submitted as http://code.google.com/p/go/source/detail?r=56ec78826237 *** time: parse and format fractional seconds R=golang-dev, rogpeppe, r, dsymonds, ...
13 years, 9 months ago (2011-08-07 21:50:32 UTC) #16
rsc
I think this might be too strict. I had hoped for the logical item to ...
13 years, 8 months ago (2011-08-08 13:32:11 UTC) #17
r2
13 years, 8 months ago (2011-08-08 13:42:26 UTC) #18
On 08/08/2011, at 11:32 PM, Russ Cox wrote:

> I think this might be too strict.
> 
> I had hoped for the logical item to stay 'seconds',
> so that "05", "05.0", "05.0000" all denote the
> 'seconds chunk', with the digit count being a
> precision used by Format but ignored by Parse.
> 
> It seems likely that most places where we
> might want to allow parsing of fractional seconds,
> we would also want to allow parsing without them
> or with a different number of significant digits.

Perhaps, but you also need to respect the format when you parse, because you
must be able to use the same format string for parsing as for printing.  What
you're asking is therefore a new feature, not a change to the existing behavior,
and it's a change I've been pondering since before this work.

In other words, the only thing that your (and Brad's) request is asking for is
accepting optional decimal followed by digits when parsing the seconds field.
Put that way, I think you can see that's a little dangerous or at least tricky 
(15.23.14.02.01.59.2006), which is why I'm still mulling it over.  But such
cases may be unlikely or unimportant enough to ignore.

There are other approaches possible. There could be a different entry point for
this case, or there could be a special "optional fraction" format indicator.

In summary, I don't think it's as clear cut as you make out, and what's there
now needs to be there anyway.

-rob

Sign in to reply to this message.

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