OSDN Git Service

delete miner
[bytom/vapor.git] / vendor / github.com / go-playground / locales / ksh / ksh.go
1 package ksh
2
3 import (
4         "math"
5         "strconv"
6         "time"
7
8         "github.com/go-playground/locales"
9         "github.com/go-playground/locales/currency"
10 )
11
12 type ksh struct {
13         locale                 string
14         pluralsCardinal        []locales.PluralRule
15         pluralsOrdinal         []locales.PluralRule
16         pluralsRange           []locales.PluralRule
17         decimal                string
18         group                  string
19         minus                  string
20         percent                string
21         percentSuffix          string
22         perMille               string
23         timeSeparator          string
24         inifinity              string
25         currencies             []string // idx = enum of currency code
26         currencyPositiveSuffix string
27         currencyNegativeSuffix string
28         monthsAbbreviated      []string
29         monthsNarrow           []string
30         monthsWide             []string
31         daysAbbreviated        []string
32         daysNarrow             []string
33         daysShort              []string
34         daysWide               []string
35         periodsAbbreviated     []string
36         periodsNarrow          []string
37         periodsShort           []string
38         periodsWide            []string
39         erasAbbreviated        []string
40         erasNarrow             []string
41         erasWide               []string
42         timezones              map[string]string
43 }
44
45 // New returns a new instance of translator for the 'ksh' locale
46 func New() locales.Translator {
47         return &ksh{
48                 locale:                 "ksh",
49                 pluralsCardinal:        []locales.PluralRule{1, 2, 6},
50                 pluralsOrdinal:         nil,
51                 pluralsRange:           nil,
52                 decimal:                ",",
53                 group:                  " ",
54                 minus:                  "−",
55                 percent:                "%",
56                 perMille:               "‰",
57                 timeSeparator:          ":",
58                 inifinity:              "∞",
59                 currencies:             []string{"ADP", "AED", "AFA", "AFN", "ALK", "ALL", "AMD", "ANG", "AOA", "AOK", "AON", "AOR", "ARA", "ARL", "ARM", "ARP", "ARS", "ATS", "AUD", "AWG", "AZM", "AZN", "BAD", "BAM", "BAN", "BBD", "BDT", "BEC", "BEF", "BEL", "BGL", "BGM", "BGN", "BGO", "BHD", "BIF", "BMD", "BND", "BOB", "BOL", "BOP", "BOV", "BRB", "BRC", "BRE", "BRL", "BRN", "BRR", "BRZ", "BSD", "BTN", "BUK", "BWP", "BYB", "BYN", "BYR", "BZD", "CAD", "CDF", "CHE", "CHF", "CHW", "CLE", "CLF", "CLP", "CNX", "CNY", "COP", "COU", "CRC", "CSD", "CSK", "CUC", "CUP", "CVE", "CYP", "CZK", "DDM", "DEM", "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ESA", "ESB", "ESP", "ETB", "EUR", "FIM", "FJD", "FKP", "FRF", "GBP", "GEK", "GEL", "GHC", "GHS", "GIP", "GMD", "GNF", "GNS", "GQE", "GRD", "GTQ", "GWE", "GWP", "GYD", "HKD", "HNL", "HRD", "HRK", "HTG", "HUF", "IDR", "IEP", "ILP", "ILR", "ILS", "INR", "IQD", "IRR", "ISJ", "ISK", "ITL", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", "KPW", "KRH", "KRO", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", "LTL", "LTT", "LUC", "LUF", "LUL", "LVL", "LVR", "LYD", "MAD", "MAF", "MCF", "MDC", "MDL", "MGA", "MGF", "MKD", "MKN", "MLF", "MMK", "MNT", "MOP", "MRO", "MTL", "MTP", "MUR", "MVP", "MVR", "MWK", "MXN", "MXP", "MXV", "MYR", "MZE", "MZM", "MZN", "NAD", "NGN", "NIC", "NIO", "NLG", "NOK", "NPR", "NZD", "OMR", "PAB", "PEI", "PEN", "PES", "PGK", "PHP", "PKR", "PLN", "PLZ", "PTE", "PYG", "QAR", "RHD", "ROL", "RON", "RSD", "RUB", "RUR", "RWF", "SAR", "SBD", "SCR", "SDD", "SDG", "SDP", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRD", "SRG", "SSP", "STD", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "USD", "USN", "USS", "UYI", "UYP", "UYU", "UZS", "VEB", "VEF", "VND", "VNN", "VUV", "WST", "XAF", "XAG", "XAU", "XBA", "XBB", "XBC", "XBD", "XCD", "XDR", "XEU", "XFO", "XFU", "XOF", "XPD", "XPF", "XPT", "XRE", "XSU", "XTS", "XUA", "XXX", "YDD", "YER", "YUD", "YUM", "YUN", "YUR", "ZAL", "ZAR", "ZMK", "ZMW", "ZRN", "ZRZ", "ZWD", "ZWL", "ZWR"},
60                 percentSuffix:          " ",
61                 currencyPositiveSuffix: " ",
62                 currencyNegativeSuffix: " ",
63                 monthsAbbreviated:      []string{"", "Jan", "Fäb", "Mäz", "Apr", "Mai", "Jun", "Jul", "Ouj", "Säp", "Okt", "Nov", "Dez"},
64                 monthsNarrow:           []string{"", "J", "F", "M", "A", "M", "J", "J", "O", "S", "O", "N", "D"},
65                 monthsWide:             []string{"", "Jannewa", "Fäbrowa", "Määz", "Aprell", "Mai", "Juuni", "Juuli", "Oujoß", "Septämber", "Oktohber", "Novämber", "Dezämber"},
66                 daysAbbreviated:        []string{"Su.", "Mo.", "Di.", "Me.", "Du.", "Fr.", "Sa."},
67                 daysNarrow:             []string{"S", "M", "D", "M", "D", "F", "S"},
68                 daysShort:              []string{"Su", "Mo", "Di", "Me", "Du", "Fr", "Sa"},
69                 daysWide:               []string{"Sunndaach", "Mohndaach", "Dinnsdaach", "Metwoch", "Dunnersdaach", "Friidaach", "Samsdaach"},
70                 periodsAbbreviated:     []string{"v.M.", "n.M."},
71                 periodsWide:            []string{"Uhr vörmiddaachs", "Uhr nommendaachs"},
72                 erasAbbreviated:        []string{"v. Chr.", "n. Chr."},
73                 erasNarrow:             []string{"vC", "nC"},
74                 erasWide:               []string{"vür Krestos", "noh Krestos"},
75                 timezones:              map[string]string{"LHST": "LHST", "HNPM": "HNPM", "UYT": "UYT", "TMST": "TMST", "HENOMX": "HENOMX", "AEST": "AEST", "WAT": "Jewöhnlijje Wäß-Affrekaanesche Zigg", "CLST": "CLST", "GFT": "GFT", "HNCU": "HNCU", "HADT": "HADT", "EST": "EST", "EAT": "Oß-Affrekaanesche Zigg", "HKST": "HKST", "WESZ": "Weß-Europpa sing Summerzick", "ARST": "ARST", "AEDT": "AEDT", "WAST": "Wäß-Affrekaanesche Sommerzigg", "BOT": "BOT", "ADT": "ADT", "HNNOMX": "HNNOMX", "JST": "JST", "WARST": "WARST", "HEOG": "HEOG", "HKT": "HKT", "GYT": "GYT", "WEZ": "Weß-Europpa sing jewöhnlijje Zick", "MEZ": "Meddel-Europpa sing jewöhnlijje Zick", "ACST": "ACST", "UYST": "UYST", "PDT": "PDT", "BT": "BT", "ACWST": "ACWST", "OESZ": "Oß-Europpa sing Summerzick", "LHDT": "LHDT", "AKDT": "AKDT", "ECT": "ECT", "CST": "CST", "CDT": "CDT", "CHADT": "CHADT", "MST": "MST", "MESZ": "Meddel-Europpa sing Summerzick", "NZST": "NZST", "ChST": "ChST", "CHAST": "CHAST", "SGT": "SGT", "GMT": "Greenwich sing Standat-Zick", "HNPMX": "HNPMX", "WIB": "WIB", "HEPM": "HEPM", "AWDT": "AWDT", "∅∅∅": "∅∅∅", "CAT": "Zentraal-Affrekaanesche Zigg", "TMT": "TMT", "WART": "WART", "HAST": "HAST", "IST": "IST", "HNEG": "HNEG", "MDT": "MDT", "SRT": "SRT", "HEEG": "HEEG", "HAT": "HAT", "HEPMX": "HEPMX", "OEZ": "Oß-Europpa sing jewöhnlijje Zick", "NZDT": "NZDT", "ART": "ART", "ACWDT": "ACWDT", "JDT": "JDT", "SAST": "Söd-Affrekaanesche Zigg", "HNT": "HNT", "PST": "PST", "HECU": "HECU", "AST": "AST", "CLT": "CLT", "COST": "COST", "EDT": "EDT", "AWST": "AWST", "VET": "VET", "MYT": "MYT", "WIT": "WIT", "WITA": "WITA", "HNOG": "HNOG", "COT": "COT", "AKST": "AKST", "ACDT": "ACDT"},
76         }
77 }
78
79 // Locale returns the current translators string locale
80 func (ksh *ksh) Locale() string {
81         return ksh.locale
82 }
83
84 // PluralsCardinal returns the list of cardinal plural rules associated with 'ksh'
85 func (ksh *ksh) PluralsCardinal() []locales.PluralRule {
86         return ksh.pluralsCardinal
87 }
88
89 // PluralsOrdinal returns the list of ordinal plural rules associated with 'ksh'
90 func (ksh *ksh) PluralsOrdinal() []locales.PluralRule {
91         return ksh.pluralsOrdinal
92 }
93
94 // PluralsRange returns the list of range plural rules associated with 'ksh'
95 func (ksh *ksh) PluralsRange() []locales.PluralRule {
96         return ksh.pluralsRange
97 }
98
99 // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'ksh'
100 func (ksh *ksh) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
101
102         n := math.Abs(num)
103
104         if n == 0 {
105                 return locales.PluralRuleZero
106         } else if n == 1 {
107                 return locales.PluralRuleOne
108         }
109
110         return locales.PluralRuleOther
111 }
112
113 // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'ksh'
114 func (ksh *ksh) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
115         return locales.PluralRuleUnknown
116 }
117
118 // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'ksh'
119 func (ksh *ksh) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
120         return locales.PluralRuleUnknown
121 }
122
123 // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
124 func (ksh *ksh) MonthAbbreviated(month time.Month) string {
125         return ksh.monthsAbbreviated[month]
126 }
127
128 // MonthsAbbreviated returns the locales abbreviated months
129 func (ksh *ksh) MonthsAbbreviated() []string {
130         return ksh.monthsAbbreviated[1:]
131 }
132
133 // MonthNarrow returns the locales narrow month given the 'month' provided
134 func (ksh *ksh) MonthNarrow(month time.Month) string {
135         return ksh.monthsNarrow[month]
136 }
137
138 // MonthsNarrow returns the locales narrow months
139 func (ksh *ksh) MonthsNarrow() []string {
140         return ksh.monthsNarrow[1:]
141 }
142
143 // MonthWide returns the locales wide month given the 'month' provided
144 func (ksh *ksh) MonthWide(month time.Month) string {
145         return ksh.monthsWide[month]
146 }
147
148 // MonthsWide returns the locales wide months
149 func (ksh *ksh) MonthsWide() []string {
150         return ksh.monthsWide[1:]
151 }
152
153 // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
154 func (ksh *ksh) WeekdayAbbreviated(weekday time.Weekday) string {
155         return ksh.daysAbbreviated[weekday]
156 }
157
158 // WeekdaysAbbreviated returns the locales abbreviated weekdays
159 func (ksh *ksh) WeekdaysAbbreviated() []string {
160         return ksh.daysAbbreviated
161 }
162
163 // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
164 func (ksh *ksh) WeekdayNarrow(weekday time.Weekday) string {
165         return ksh.daysNarrow[weekday]
166 }
167
168 // WeekdaysNarrow returns the locales narrow weekdays
169 func (ksh *ksh) WeekdaysNarrow() []string {
170         return ksh.daysNarrow
171 }
172
173 // WeekdayShort returns the locales short weekday given the 'weekday' provided
174 func (ksh *ksh) WeekdayShort(weekday time.Weekday) string {
175         return ksh.daysShort[weekday]
176 }
177
178 // WeekdaysShort returns the locales short weekdays
179 func (ksh *ksh) WeekdaysShort() []string {
180         return ksh.daysShort
181 }
182
183 // WeekdayWide returns the locales wide weekday given the 'weekday' provided
184 func (ksh *ksh) WeekdayWide(weekday time.Weekday) string {
185         return ksh.daysWide[weekday]
186 }
187
188 // WeekdaysWide returns the locales wide weekdays
189 func (ksh *ksh) WeekdaysWide() []string {
190         return ksh.daysWide
191 }
192
193 // Decimal returns the decimal point of number
194 func (ksh *ksh) Decimal() string {
195         return ksh.decimal
196 }
197
198 // Group returns the group of number
199 func (ksh *ksh) Group() string {
200         return ksh.group
201 }
202
203 // Group returns the minus sign of number
204 func (ksh *ksh) Minus() string {
205         return ksh.minus
206 }
207
208 // FmtNumber returns 'num' with digits/precision of 'v' for 'ksh' and handles both Whole and Real numbers based on 'v'
209 func (ksh *ksh) FmtNumber(num float64, v uint64) string {
210
211         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
212         l := len(s) + 4 + 2*len(s[:len(s)-int(v)-1])/3
213         count := 0
214         inWhole := v == 0
215         b := make([]byte, 0, l)
216
217         for i := len(s) - 1; i >= 0; i-- {
218
219                 if s[i] == '.' {
220                         b = append(b, ksh.decimal[0])
221                         inWhole = true
222                         continue
223                 }
224
225                 if inWhole {
226                         if count == 3 {
227                                 for j := len(ksh.group) - 1; j >= 0; j-- {
228                                         b = append(b, ksh.group[j])
229                                 }
230                                 count = 1
231                         } else {
232                                 count++
233                         }
234                 }
235
236                 b = append(b, s[i])
237         }
238
239         if num < 0 {
240                 for j := len(ksh.minus) - 1; j >= 0; j-- {
241                         b = append(b, ksh.minus[j])
242                 }
243         }
244
245         // reverse
246         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
247                 b[i], b[j] = b[j], b[i]
248         }
249
250         return string(b)
251 }
252
253 // FmtPercent returns 'num' with digits/precision of 'v' for 'ksh' and handles both Whole and Real numbers based on 'v'
254 // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
255 func (ksh *ksh) FmtPercent(num float64, v uint64) string {
256         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
257         l := len(s) + 7
258         b := make([]byte, 0, l)
259
260         for i := len(s) - 1; i >= 0; i-- {
261
262                 if s[i] == '.' {
263                         b = append(b, ksh.decimal[0])
264                         continue
265                 }
266
267                 b = append(b, s[i])
268         }
269
270         if num < 0 {
271                 for j := len(ksh.minus) - 1; j >= 0; j-- {
272                         b = append(b, ksh.minus[j])
273                 }
274         }
275
276         // reverse
277         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
278                 b[i], b[j] = b[j], b[i]
279         }
280
281         b = append(b, ksh.percentSuffix...)
282
283         b = append(b, ksh.percent...)
284
285         return string(b)
286 }
287
288 // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'ksh'
289 func (ksh *ksh) FmtCurrency(num float64, v uint64, currency currency.Type) string {
290
291         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
292         symbol := ksh.currencies[currency]
293         l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
294         count := 0
295         inWhole := v == 0
296         b := make([]byte, 0, l)
297
298         for i := len(s) - 1; i >= 0; i-- {
299
300                 if s[i] == '.' {
301                         b = append(b, ksh.decimal[0])
302                         inWhole = true
303                         continue
304                 }
305
306                 if inWhole {
307                         if count == 3 {
308                                 for j := len(ksh.group) - 1; j >= 0; j-- {
309                                         b = append(b, ksh.group[j])
310                                 }
311                                 count = 1
312                         } else {
313                                 count++
314                         }
315                 }
316
317                 b = append(b, s[i])
318         }
319
320         if num < 0 {
321                 for j := len(ksh.minus) - 1; j >= 0; j-- {
322                         b = append(b, ksh.minus[j])
323                 }
324         }
325
326         // reverse
327         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
328                 b[i], b[j] = b[j], b[i]
329         }
330
331         if int(v) < 2 {
332
333                 if v == 0 {
334                         b = append(b, ksh.decimal...)
335                 }
336
337                 for i := 0; i < 2-int(v); i++ {
338                         b = append(b, '0')
339                 }
340         }
341
342         b = append(b, ksh.currencyPositiveSuffix...)
343
344         b = append(b, symbol...)
345
346         return string(b)
347 }
348
349 // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'ksh'
350 // in accounting notation.
351 func (ksh *ksh) FmtAccounting(num float64, v uint64, currency currency.Type) string {
352
353         s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
354         symbol := ksh.currencies[currency]
355         l := len(s) + len(symbol) + 6 + 2*len(s[:len(s)-int(v)-1])/3
356         count := 0
357         inWhole := v == 0
358         b := make([]byte, 0, l)
359
360         for i := len(s) - 1; i >= 0; i-- {
361
362                 if s[i] == '.' {
363                         b = append(b, ksh.decimal[0])
364                         inWhole = true
365                         continue
366                 }
367
368                 if inWhole {
369                         if count == 3 {
370                                 for j := len(ksh.group) - 1; j >= 0; j-- {
371                                         b = append(b, ksh.group[j])
372                                 }
373                                 count = 1
374                         } else {
375                                 count++
376                         }
377                 }
378
379                 b = append(b, s[i])
380         }
381
382         if num < 0 {
383
384                 for j := len(ksh.minus) - 1; j >= 0; j-- {
385                         b = append(b, ksh.minus[j])
386                 }
387
388         }
389
390         // reverse
391         for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
392                 b[i], b[j] = b[j], b[i]
393         }
394
395         if int(v) < 2 {
396
397                 if v == 0 {
398                         b = append(b, ksh.decimal...)
399                 }
400
401                 for i := 0; i < 2-int(v); i++ {
402                         b = append(b, '0')
403                 }
404         }
405
406         if num < 0 {
407                 b = append(b, ksh.currencyNegativeSuffix...)
408                 b = append(b, symbol...)
409         } else {
410
411                 b = append(b, ksh.currencyPositiveSuffix...)
412                 b = append(b, symbol...)
413         }
414
415         return string(b)
416 }
417
418 // FmtDateShort returns the short date representation of 't' for 'ksh'
419 func (ksh *ksh) FmtDateShort(t time.Time) string {
420
421         b := make([]byte, 0, 32)
422
423         b = strconv.AppendInt(b, int64(t.Day()), 10)
424         b = append(b, []byte{0x2e, 0x20}...)
425         b = strconv.AppendInt(b, int64(t.Month()), 10)
426         b = append(b, []byte{0x2e, 0x20}...)
427
428         if t.Year() > 0 {
429                 b = strconv.AppendInt(b, int64(t.Year()), 10)
430         } else {
431                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
432         }
433
434         return string(b)
435 }
436
437 // FmtDateMedium returns the medium date representation of 't' for 'ksh'
438 func (ksh *ksh) FmtDateMedium(t time.Time) string {
439
440         b := make([]byte, 0, 32)
441
442         b = strconv.AppendInt(b, int64(t.Day()), 10)
443         b = append(b, []byte{0x2e, 0x20}...)
444         b = append(b, ksh.monthsAbbreviated[t.Month()]...)
445         b = append(b, []byte{0x2e, 0x20}...)
446
447         if t.Year() > 0 {
448                 b = strconv.AppendInt(b, int64(t.Year()), 10)
449         } else {
450                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
451         }
452
453         return string(b)
454 }
455
456 // FmtDateLong returns the long date representation of 't' for 'ksh'
457 func (ksh *ksh) FmtDateLong(t time.Time) string {
458
459         b := make([]byte, 0, 32)
460
461         b = strconv.AppendInt(b, int64(t.Day()), 10)
462         b = append(b, []byte{0x2e, 0x20}...)
463         b = append(b, ksh.monthsWide[t.Month()]...)
464         b = append(b, []byte{0x20}...)
465
466         if t.Year() > 0 {
467                 b = strconv.AppendInt(b, int64(t.Year()), 10)
468         } else {
469                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
470         }
471
472         return string(b)
473 }
474
475 // FmtDateFull returns the full date representation of 't' for 'ksh'
476 func (ksh *ksh) FmtDateFull(t time.Time) string {
477
478         b := make([]byte, 0, 32)
479
480         b = append(b, ksh.daysWide[t.Weekday()]...)
481         b = append(b, []byte{0x2c, 0x20, 0x64, 0xc3, 0xa4}...)
482         b = append(b, []byte{0x20}...)
483         b = strconv.AppendInt(b, int64(t.Day()), 10)
484         b = append(b, []byte{0x2e, 0x20}...)
485         b = append(b, ksh.monthsWide[t.Month()]...)
486         b = append(b, []byte{0x20}...)
487
488         if t.Year() > 0 {
489                 b = strconv.AppendInt(b, int64(t.Year()), 10)
490         } else {
491                 b = strconv.AppendInt(b, int64(-t.Year()), 10)
492         }
493
494         return string(b)
495 }
496
497 // FmtTimeShort returns the short time representation of 't' for 'ksh'
498 func (ksh *ksh) FmtTimeShort(t time.Time) string {
499
500         b := make([]byte, 0, 32)
501
502         if t.Hour() < 10 {
503                 b = append(b, '0')
504         }
505
506         b = strconv.AppendInt(b, int64(t.Hour()), 10)
507         b = append(b, ksh.timeSeparator...)
508
509         if t.Minute() < 10 {
510                 b = append(b, '0')
511         }
512
513         b = strconv.AppendInt(b, int64(t.Minute()), 10)
514
515         return string(b)
516 }
517
518 // FmtTimeMedium returns the medium time representation of 't' for 'ksh'
519 func (ksh *ksh) FmtTimeMedium(t time.Time) string {
520
521         b := make([]byte, 0, 32)
522
523         if t.Hour() < 10 {
524                 b = append(b, '0')
525         }
526
527         b = strconv.AppendInt(b, int64(t.Hour()), 10)
528         b = append(b, ksh.timeSeparator...)
529
530         if t.Minute() < 10 {
531                 b = append(b, '0')
532         }
533
534         b = strconv.AppendInt(b, int64(t.Minute()), 10)
535         b = append(b, ksh.timeSeparator...)
536
537         if t.Second() < 10 {
538                 b = append(b, '0')
539         }
540
541         b = strconv.AppendInt(b, int64(t.Second()), 10)
542
543         return string(b)
544 }
545
546 // FmtTimeLong returns the long time representation of 't' for 'ksh'
547 func (ksh *ksh) FmtTimeLong(t time.Time) string {
548
549         b := make([]byte, 0, 32)
550
551         if t.Hour() < 10 {
552                 b = append(b, '0')
553         }
554
555         b = strconv.AppendInt(b, int64(t.Hour()), 10)
556         b = append(b, ksh.timeSeparator...)
557
558         if t.Minute() < 10 {
559                 b = append(b, '0')
560         }
561
562         b = strconv.AppendInt(b, int64(t.Minute()), 10)
563         b = append(b, ksh.timeSeparator...)
564
565         if t.Second() < 10 {
566                 b = append(b, '0')
567         }
568
569         b = strconv.AppendInt(b, int64(t.Second()), 10)
570         b = append(b, []byte{0x20}...)
571
572         tz, _ := t.Zone()
573         b = append(b, tz...)
574
575         return string(b)
576 }
577
578 // FmtTimeFull returns the full time representation of 't' for 'ksh'
579 func (ksh *ksh) FmtTimeFull(t time.Time) string {
580
581         b := make([]byte, 0, 32)
582
583         if t.Hour() < 10 {
584                 b = append(b, '0')
585         }
586
587         b = strconv.AppendInt(b, int64(t.Hour()), 10)
588         b = append(b, ksh.timeSeparator...)
589
590         if t.Minute() < 10 {
591                 b = append(b, '0')
592         }
593
594         b = strconv.AppendInt(b, int64(t.Minute()), 10)
595         b = append(b, ksh.timeSeparator...)
596
597         if t.Second() < 10 {
598                 b = append(b, '0')
599         }
600
601         b = strconv.AppendInt(b, int64(t.Second()), 10)
602         b = append(b, []byte{0x20}...)
603
604         tz, _ := t.Zone()
605
606         if btz, ok := ksh.timezones[tz]; ok {
607                 b = append(b, btz...)
608         } else {
609                 b = append(b, tz...)
610         }
611
612         return string(b)
613 }