]> Cypherpunks repositories - gostls13.git/commitdiff
time: make it clearer how to format a fractional second
authorRob Pike <r@golang.org>
Wed, 15 Jul 2015 05:02:38 +0000 (15:02 +1000)
committerRob Pike <r@golang.org>
Wed, 15 Jul 2015 05:13:05 +0000 (05:13 +0000)
Fixes #10963.

Change-Id: I8d769b4d25b306f2df41f882ec01d97bbd63171d
Reviewed-on: https://go-review.googlesource.com/12221
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
src/time/format.go

index b15101e16051cfbdd37aa94eaa973e18405d1d89..873d3ffde91d95a4282731ae7d87b9ccd4e0c0d7 100644 (file)
@@ -39,6 +39,9 @@ import "errors"
 // offset for the UTC zone.  Thus:
 //     Z0700  Z or ±hhmm
 //     Z07:00 Z or ±hh:mm
+//
+// The executable example for time.Format demonstrates the working
+// of the layout string in detail and is a good reference.
 const (
        ANSIC       = "Mon Jan _2 15:04:05 2006"
        UnixDate    = "Mon Jan _2 15:04:05 MST 2006"
@@ -405,6 +408,11 @@ func (t Time) String() string {
 // would be displayed if it were the value; it serves as an example of the
 // desired output. The same display rules will then be applied to the time
 // value.
+//
+// A fractional second is represented by adding a period and zeros
+// to the end of the seconds section of layout string, as in "15:04:05.000"
+// to format a time stamp with millisecond precision.
+//
 // Predefined layouts ANSIC, UnixDate, RFC3339 and others describe standard
 // and convenient representations of the reference time. For more information
 // about the formats and the definition of the reference time, see the
@@ -671,7 +679,7 @@ func skip(value, prefix string) (string, error) {
 // and convenient representations of the reference time. For more information
 // about the formats and the definition of the reference time, see the
 // documentation for ANSIC and the other constants defined by this package.
-// Also, the executable Example for time.Format demonstrates the working
+// Also, the executable example for time.Format demonstrates the working
 // of the layout string in detail and is a good reference.
 //
 // Elements omitted from the value are assumed to be zero or, when