]> Cypherpunks repositories - gostls13.git/commitdiff
do not crash printing the zero value for time.Time.
authorRuss Cox <rsc@golang.org>
Mon, 14 Sep 2009 23:45:35 +0000 (16:45 -0700)
committerRuss Cox <rsc@golang.org>
Mon, 14 Sep 2009 23:45:35 +0000 (16:45 -0700)
R=r
DELTA=2  (1 added, 0 deleted, 1 changed)
OCL=34605
CL=34608

src/pkg/time/time.go

index 1e4990b10f0e05d47c76ea34961a01e06625d57a..7f5f53e3fcd45dc17bbdce221d0bf114ab3206b2 100644 (file)
@@ -250,6 +250,7 @@ var shortDayNames = []string{
 }
 
 var shortMonthNames = []string{
+       "---",
        "Jan",
        "Feb",
        "Mar",
@@ -301,7 +302,7 @@ func format(t *Time, fmt string) string {
                        case 'a':       // %a abbreviated weekday name
                                bp = addString(buf, bp, shortDayNames[t.Weekday]);
                        case 'b':       // %b abbreviated month name
-                               bp = addString(buf, bp, shortMonthNames[t.Month-1]);
+                               bp = addString(buf, bp, shortMonthNames[t.Month]);
                        case 'd':       // %d day of month (01-31)
                                decimal(buf[bp:bp+2], t.Day);
                                bp += 2;