]> Cypherpunks repositories - gostls13.git/commitdiff
time: use "2006-01-02 15:04:05.999999999 -0700 MST" as String format
authorRuss Cox <rsc@golang.org>
Tue, 14 Feb 2012 16:17:48 +0000 (11:17 -0500)
committerRuss Cox <rsc@golang.org>
Tue, 14 Feb 2012 16:17:48 +0000 (11:17 -0500)
This change shows all the information present
in the Time value (now including fractional seconds)
and also arranges the fields so that, within a single time zone,
string comparison and time comparison agree.

R=golang-dev, rogpeppe, r
CC=golang-dev
https://golang.org/cl/5654078

src/pkg/time/example_test.go
src/pkg/time/format.go

index 153b1a3b660ed0f1ee548fa260b26423b9515b96..b25e64cda3e0e1ad999713afd3e30de5a0c88283 100644 (file)
@@ -51,7 +51,7 @@ func ExampleMonth() {
        }
 }
 
-// Go launched at Tue Nov 10 15:00:00 -0800 PST 2009
+// Go launched at 2009-11-10 15:00:00 -0800 PST
 func ExampleDate() {
        t := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC)
        fmt.Printf("Go launched at %s\n", t.Local())
index 98cf081cfc5dab08ab5d527200e45368be759fc0..ef6f1f335142c3b058713ea3c88c8cc9d508619f 100644 (file)
@@ -344,9 +344,9 @@ func formatNano(nanosec, n int, trim bool) string {
 }
 
 // String returns the time formatted using the format string
-//     "Mon Jan _2 15:04:05 -0700 MST 2006"
+//     "2006-01-02 15:04:05.999999999 -0700 MST"
 func (t Time) String() string {
-       return t.Format("Mon Jan _2 15:04:05 -0700 MST 2006")
+       return t.Format("2006-01-02 15:04:05.999999999 -0700 MST")
 }
 
 type buffer []byte