From c5a441ac70e5164e91e1c0a8141f4053dfb6bc69 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 14 Sep 2009 16:45:35 -0700 Subject: [PATCH] do not crash printing the zero value for time.Time. R=r DELTA=2 (1 added, 0 deleted, 1 changed) OCL=34605 CL=34608 --- src/pkg/time/time.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pkg/time/time.go b/src/pkg/time/time.go index 1e4990b10f0..7f5f53e3fcd 100644 --- a/src/pkg/time/time.go +++ b/src/pkg/time/time.go @@ -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;