diff options
| author | Russ Cox <rsc@golang.org> | 2010-03-30 14:54:32 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2010-03-30 14:54:32 -0700 |
| commit | 5aaf7119fc2ef4728973cad70dc4a74cf804ae51 (patch) | |
| tree | 71abb665171ce4f944c4893104d832490527c548 /src/pkg/time/time.go | |
| parent | e9fd79e84bf114014aff7b189c6a14cc58504821 (diff) | |
| download | golang-5aaf7119fc2ef4728973cad70dc4a74cf804ae51.tar.gz | |
time: do not segment time strings by character class.
instead use pure substring matching to find template values.
this makes stdZulu unnecessary and allows formats
like "20060102 030405" (used in some internet protocols).
this makes Parse not handle years < 0000 or > 9999 anymore.
that seems like an okay price to pay, trading hypothetical
functionality for real functionality.
also changed the comments on the Time struct to use the
same reference date as the format and parse routines.
R=r
CC=golang-dev
http://codereview.appspot.com/833045
Diffstat (limited to 'src/pkg/time/time.go')
| -rw-r--r-- | src/pkg/time/time.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pkg/time/time.go b/src/pkg/time/time.go index 7b7887485..4abd11230 100644 --- a/src/pkg/time/time.go +++ b/src/pkg/time/time.go @@ -43,12 +43,12 @@ const ( // Time is the struct representing a parsed time value. type Time struct { - Year int64 // 2008 is 2008 - Month, Day int // Sep-17 is 9, 17 - Hour, Minute, Second int // 10:43:12 is 10, 43, 12 - Weekday int // Sunday, Monday, ... - ZoneOffset int // seconds east of UTC - Zone string + Year int64 // 2006 is 2006 + Month, Day int // Jan-2 is 1, 2 + Hour, Minute, Second int // 15:04:05 is 15, 4, 5. + Weekday int // Sunday, Monday, ... + ZoneOffset int // seconds east of UTC, e.g. -7*60 for -0700 + Zone string // e.g., "MST" } var nonleapyear = []int{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} |
