1package gsw_CH
2
3import (
4	"math"
5	"strconv"
6	"time"
7
8	"github.com/gohugoio/locales"
9	"github.com/gohugoio/locales/currency"
10)
11
12type gsw_CH 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 'gsw_CH' locale
46func New() locales.Translator {
47	return &gsw_CH{
48		locale:                 "gsw_CH",
49		pluralsCardinal:        []locales.PluralRule{2, 6},
50		pluralsOrdinal:         []locales.PluralRule{6},
51		pluralsRange:           []locales.PluralRule{2, 6},
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", "CNH", "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", "MRU", "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", "STN", "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", "UYW", "UZS", "VEB", "VEF", "VES", "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", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"},
64		monthsNarrow:           []string{"", "J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"},
65		monthsWide:             []string{"", "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "Auguscht", "Septämber", "Oktoober", "Novämber", "Dezämber"},
66		daysAbbreviated:        []string{"Su.", "Mä.", "Zi.", "Mi.", "Du.", "Fr.", "Sa."},
67		daysNarrow:             []string{"S", "M", "D", "M", "D", "F", "S"},
68		daysWide:               []string{"Sunntig", "Määntig", "Ziischtig", "Mittwuch", "Dunschtig", "Friitig", "Samschtig"},
69		periodsAbbreviated:     []string{"vorm.", "nam."},
70		periodsWide:            []string{"am Vormittag", "am Namittag"},
71		erasAbbreviated:        []string{"v. Chr.", "n. Chr."},
72		erasNarrow:             []string{"v. Chr.", "n. Chr."},
73		erasWide:               []string{"v. Chr.", "n. Chr."},
74		timezones:              map[string]string{"ACDT": "ACDT", "ACST": "ACST", "ACWDT": "ACWDT", "ACWST": "ACWST", "ADT": "ADT", "AEDT": "AEDT", "AEST": "AEST", "AKDT": "Alaska-Summerziit", "AKST": "Alaska-Schtandardziit", "ARST": "ARST", "ART": "ART", "AST": "AST", "AWDT": "AWDT", "AWST": "AWST", "BOT": "BOT", "BT": "BT", "CAT": "Zentralafrikanischi Ziit", "CDT": "Amerika-Zentraal Summerziit", "CHADT": "CHADT", "CHAST": "CHAST", "CLST": "CLST", "CLT": "CLT", "COST": "COST", "COT": "COT", "CST": "Amerika-Zentraal Schtandardziit", "ChST": "ChST", "EAT": "Oschtafrikanischi Ziit", "ECT": "ECT", "EDT": "EDT", "EST": "EST", "GFT": "GFT", "GMT": "GMT", "GST": "GST", "GYT": "GYT", "HADT": "HADT", "HAST": "HAST", "HAT": "HAT", "HECU": "HECU", "HEEG": "HEEG", "HENOMX": "HENOMX", "HEOG": "HEOG", "HEPM": "HEPM", "HEPMX": "HEPMX", "HKST": "HKST", "HKT": "HKT", "HNCU": "HNCU", "HNEG": "HNEG", "HNNOMX": "HNNOMX", "HNOG": "HNOG", "HNPM": "HNPM", "HNPMX": "HNPMX", "HNT": "HNT", "IST": "IST", "JDT": "JDT", "JST": "JST", "LHDT": "LHDT", "LHST": "LHST", "MDT": "MDT", "MESZ": "Mitteleuropäischi Summerziit", "MEZ": "Mitteleuropäischi Schtandardziit", "MST": "MST", "MYT": "MYT", "NZDT": "NZDT", "NZST": "NZST", "OESZ": "Oschteuropäischi Summerziit", "OEZ": "Oschteuropäischi Schtandardziit", "PDT": "PDT", "PST": "PST", "SAST": "Süüdafrikanischi ziit", "SGT": "SGT", "SRT": "SRT", "TMST": "TMST", "TMT": "TMT", "UYST": "UYST", "UYT": "UYT", "VET": "VET", "WARST": "WARST", "WART": "WART", "WAST": "Weschtafrikanischi Summerziit", "WAT": "Weschtafrikanischi Schtandardziit", "WESZ": "Weschteuropäischi Summerziit", "WEZ": "Weschteuropäischi Schtandardziit", "WIB": "WIB", "WIT": "WIT", "WITA": "WITA", "∅∅∅": "∅∅∅"},
75	}
76}
77
78// Locale returns the current translators string locale
79func (gsw *gsw_CH) Locale() string {
80	return gsw.locale
81}
82
83// PluralsCardinal returns the list of cardinal plural rules associated with 'gsw_CH'
84func (gsw *gsw_CH) PluralsCardinal() []locales.PluralRule {
85	return gsw.pluralsCardinal
86}
87
88// PluralsOrdinal returns the list of ordinal plural rules associated with 'gsw_CH'
89func (gsw *gsw_CH) PluralsOrdinal() []locales.PluralRule {
90	return gsw.pluralsOrdinal
91}
92
93// PluralsRange returns the list of range plural rules associated with 'gsw_CH'
94func (gsw *gsw_CH) PluralsRange() []locales.PluralRule {
95	return gsw.pluralsRange
96}
97
98// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'gsw_CH'
99func (gsw *gsw_CH) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
100
101	n := math.Abs(num)
102
103	if n == 1 {
104		return locales.PluralRuleOne
105	}
106
107	return locales.PluralRuleOther
108}
109
110// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'gsw_CH'
111func (gsw *gsw_CH) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
112	return locales.PluralRuleOther
113}
114
115// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'gsw_CH'
116func (gsw *gsw_CH) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
117
118	start := gsw.CardinalPluralRule(num1, v1)
119	end := gsw.CardinalPluralRule(num2, v2)
120
121	if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
122		return locales.PluralRuleOther
123	} else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
124		return locales.PluralRuleOne
125	}
126
127	return locales.PluralRuleOther
128
129}
130
131// MonthAbbreviated returns the locales abbreviated month given the 'month' provided
132func (gsw *gsw_CH) MonthAbbreviated(month time.Month) string {
133	return gsw.monthsAbbreviated[month]
134}
135
136// MonthsAbbreviated returns the locales abbreviated months
137func (gsw *gsw_CH) MonthsAbbreviated() []string {
138	return gsw.monthsAbbreviated[1:]
139}
140
141// MonthNarrow returns the locales narrow month given the 'month' provided
142func (gsw *gsw_CH) MonthNarrow(month time.Month) string {
143	return gsw.monthsNarrow[month]
144}
145
146// MonthsNarrow returns the locales narrow months
147func (gsw *gsw_CH) MonthsNarrow() []string {
148	return gsw.monthsNarrow[1:]
149}
150
151// MonthWide returns the locales wide month given the 'month' provided
152func (gsw *gsw_CH) MonthWide(month time.Month) string {
153	return gsw.monthsWide[month]
154}
155
156// MonthsWide returns the locales wide months
157func (gsw *gsw_CH) MonthsWide() []string {
158	return gsw.monthsWide[1:]
159}
160
161// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
162func (gsw *gsw_CH) WeekdayAbbreviated(weekday time.Weekday) string {
163	return gsw.daysAbbreviated[weekday]
164}
165
166// WeekdaysAbbreviated returns the locales abbreviated weekdays
167func (gsw *gsw_CH) WeekdaysAbbreviated() []string {
168	return gsw.daysAbbreviated
169}
170
171// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
172func (gsw *gsw_CH) WeekdayNarrow(weekday time.Weekday) string {
173	return gsw.daysNarrow[weekday]
174}
175
176// WeekdaysNarrow returns the locales narrow weekdays
177func (gsw *gsw_CH) WeekdaysNarrow() []string {
178	return gsw.daysNarrow
179}
180
181// WeekdayShort returns the locales short weekday given the 'weekday' provided
182func (gsw *gsw_CH) WeekdayShort(weekday time.Weekday) string {
183	return gsw.daysShort[weekday]
184}
185
186// WeekdaysShort returns the locales short weekdays
187func (gsw *gsw_CH) WeekdaysShort() []string {
188	return gsw.daysShort
189}
190
191// WeekdayWide returns the locales wide weekday given the 'weekday' provided
192func (gsw *gsw_CH) WeekdayWide(weekday time.Weekday) string {
193	return gsw.daysWide[weekday]
194}
195
196// WeekdaysWide returns the locales wide weekdays
197func (gsw *gsw_CH) WeekdaysWide() []string {
198	return gsw.daysWide
199}
200
201// Decimal returns the decimal point of number
202func (gsw *gsw_CH) Decimal() string {
203	return gsw.decimal
204}
205
206// Group returns the group of number
207func (gsw *gsw_CH) Group() string {
208	return gsw.group
209}
210
211// Group returns the minus sign of number
212func (gsw *gsw_CH) Minus() string {
213	return gsw.minus
214}
215
216// FmtNumber returns 'num' with digits/precision of 'v' for 'gsw_CH' and handles both Whole and Real numbers based on 'v'
217func (gsw *gsw_CH) FmtNumber(num float64, v uint64) string {
218
219	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
220	l := len(s) + 4 + 3*len(s[:len(s)-int(v)-1])/3
221	count := 0
222	inWhole := v == 0
223	b := make([]byte, 0, l)
224
225	for i := len(s) - 1; i >= 0; i-- {
226
227		if s[i] == '.' {
228			b = append(b, gsw.decimal[0])
229			inWhole = true
230			continue
231		}
232
233		if inWhole {
234			if count == 3 {
235				for j := len(gsw.group) - 1; j >= 0; j-- {
236					b = append(b, gsw.group[j])
237				}
238				count = 1
239			} else {
240				count++
241			}
242		}
243
244		b = append(b, s[i])
245	}
246
247	if num < 0 {
248		for j := len(gsw.minus) - 1; j >= 0; j-- {
249			b = append(b, gsw.minus[j])
250		}
251	}
252
253	// reverse
254	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
255		b[i], b[j] = b[j], b[i]
256	}
257
258	return string(b)
259}
260
261// FmtPercent returns 'num' with digits/precision of 'v' for 'gsw_CH' and handles both Whole and Real numbers based on 'v'
262// NOTE: 'num' passed into FmtPercent is assumed to be in percent already
263func (gsw *gsw_CH) FmtPercent(num float64, v uint64) string {
264	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
265	l := len(s) + 7
266	b := make([]byte, 0, l)
267
268	for i := len(s) - 1; i >= 0; i-- {
269
270		if s[i] == '.' {
271			b = append(b, gsw.decimal[0])
272			continue
273		}
274
275		b = append(b, s[i])
276	}
277
278	if num < 0 {
279		for j := len(gsw.minus) - 1; j >= 0; j-- {
280			b = append(b, gsw.minus[j])
281		}
282	}
283
284	// reverse
285	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
286		b[i], b[j] = b[j], b[i]
287	}
288
289	b = append(b, gsw.percentSuffix...)
290
291	b = append(b, gsw.percent...)
292
293	return string(b)
294}
295
296// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'gsw_CH'
297func (gsw *gsw_CH) FmtCurrency(num float64, v uint64, currency currency.Type) string {
298
299	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
300	symbol := gsw.currencies[currency]
301	l := len(s) + len(symbol) + 6 + 3*len(s[:len(s)-int(v)-1])/3
302	count := 0
303	inWhole := v == 0
304	b := make([]byte, 0, l)
305
306	for i := len(s) - 1; i >= 0; i-- {
307
308		if s[i] == '.' {
309			b = append(b, gsw.decimal[0])
310			inWhole = true
311			continue
312		}
313
314		if inWhole {
315			if count == 3 {
316				for j := len(gsw.group) - 1; j >= 0; j-- {
317					b = append(b, gsw.group[j])
318				}
319				count = 1
320			} else {
321				count++
322			}
323		}
324
325		b = append(b, s[i])
326	}
327
328	if num < 0 {
329		for j := len(gsw.minus) - 1; j >= 0; j-- {
330			b = append(b, gsw.minus[j])
331		}
332	}
333
334	// reverse
335	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
336		b[i], b[j] = b[j], b[i]
337	}
338
339	if int(v) < 2 {
340
341		if v == 0 {
342			b = append(b, gsw.decimal...)
343		}
344
345		for i := 0; i < 2-int(v); i++ {
346			b = append(b, '0')
347		}
348	}
349
350	b = append(b, gsw.currencyPositiveSuffix...)
351
352	b = append(b, symbol...)
353
354	return string(b)
355}
356
357// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'gsw_CH'
358// in accounting notation.
359func (gsw *gsw_CH) FmtAccounting(num float64, v uint64, currency currency.Type) string {
360
361	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
362	symbol := gsw.currencies[currency]
363	l := len(s) + len(symbol) + 6 + 3*len(s[:len(s)-int(v)-1])/3
364	count := 0
365	inWhole := v == 0
366	b := make([]byte, 0, l)
367
368	for i := len(s) - 1; i >= 0; i-- {
369
370		if s[i] == '.' {
371			b = append(b, gsw.decimal[0])
372			inWhole = true
373			continue
374		}
375
376		if inWhole {
377			if count == 3 {
378				for j := len(gsw.group) - 1; j >= 0; j-- {
379					b = append(b, gsw.group[j])
380				}
381				count = 1
382			} else {
383				count++
384			}
385		}
386
387		b = append(b, s[i])
388	}
389
390	if num < 0 {
391
392		for j := len(gsw.minus) - 1; j >= 0; j-- {
393			b = append(b, gsw.minus[j])
394		}
395
396	}
397
398	// reverse
399	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
400		b[i], b[j] = b[j], b[i]
401	}
402
403	if int(v) < 2 {
404
405		if v == 0 {
406			b = append(b, gsw.decimal...)
407		}
408
409		for i := 0; i < 2-int(v); i++ {
410			b = append(b, '0')
411		}
412	}
413
414	if num < 0 {
415		b = append(b, gsw.currencyNegativeSuffix...)
416		b = append(b, symbol...)
417	} else {
418
419		b = append(b, gsw.currencyPositiveSuffix...)
420		b = append(b, symbol...)
421	}
422
423	return string(b)
424}
425
426// FmtDateShort returns the short date representation of 't' for 'gsw_CH'
427func (gsw *gsw_CH) FmtDateShort(t time.Time) string {
428
429	b := make([]byte, 0, 32)
430
431	if t.Day() < 10 {
432		b = append(b, '0')
433	}
434
435	b = strconv.AppendInt(b, int64(t.Day()), 10)
436	b = append(b, []byte{0x2e}...)
437
438	if t.Month() < 10 {
439		b = append(b, '0')
440	}
441
442	b = strconv.AppendInt(b, int64(t.Month()), 10)
443
444	b = append(b, []byte{0x2e}...)
445
446	if t.Year() > 9 {
447		b = append(b, strconv.Itoa(t.Year())[2:]...)
448	} else {
449		b = append(b, strconv.Itoa(t.Year())[1:]...)
450	}
451
452	return string(b)
453}
454
455// FmtDateMedium returns the medium date representation of 't' for 'gsw_CH'
456func (gsw *gsw_CH) FmtDateMedium(t time.Time) string {
457
458	b := make([]byte, 0, 32)
459
460	if t.Day() < 10 {
461		b = append(b, '0')
462	}
463
464	b = strconv.AppendInt(b, int64(t.Day()), 10)
465	b = append(b, []byte{0x2e}...)
466
467	if t.Month() < 10 {
468		b = append(b, '0')
469	}
470
471	b = strconv.AppendInt(b, int64(t.Month()), 10)
472
473	b = append(b, []byte{0x2e}...)
474
475	if t.Year() > 0 {
476		b = strconv.AppendInt(b, int64(t.Year()), 10)
477	} else {
478		b = strconv.AppendInt(b, int64(-t.Year()), 10)
479	}
480
481	return string(b)
482}
483
484// FmtDateLong returns the long date representation of 't' for 'gsw_CH'
485func (gsw *gsw_CH) FmtDateLong(t time.Time) string {
486
487	b := make([]byte, 0, 32)
488
489	b = strconv.AppendInt(b, int64(t.Day()), 10)
490	b = append(b, []byte{0x2e, 0x20}...)
491	b = append(b, gsw.monthsWide[t.Month()]...)
492	b = append(b, []byte{0x20}...)
493
494	if t.Year() > 0 {
495		b = strconv.AppendInt(b, int64(t.Year()), 10)
496	} else {
497		b = strconv.AppendInt(b, int64(-t.Year()), 10)
498	}
499
500	return string(b)
501}
502
503// FmtDateFull returns the full date representation of 't' for 'gsw_CH'
504func (gsw *gsw_CH) FmtDateFull(t time.Time) string {
505
506	b := make([]byte, 0, 32)
507
508	b = append(b, gsw.daysWide[t.Weekday()]...)
509	b = append(b, []byte{0x2c, 0x20}...)
510	b = strconv.AppendInt(b, int64(t.Day()), 10)
511	b = append(b, []byte{0x2e, 0x20}...)
512	b = append(b, gsw.monthsWide[t.Month()]...)
513	b = append(b, []byte{0x20}...)
514
515	if t.Year() > 0 {
516		b = strconv.AppendInt(b, int64(t.Year()), 10)
517	} else {
518		b = strconv.AppendInt(b, int64(-t.Year()), 10)
519	}
520
521	return string(b)
522}
523
524// FmtTimeShort returns the short time representation of 't' for 'gsw_CH'
525func (gsw *gsw_CH) FmtTimeShort(t time.Time) string {
526
527	b := make([]byte, 0, 32)
528
529	if t.Hour() < 10 {
530		b = append(b, '0')
531	}
532
533	b = strconv.AppendInt(b, int64(t.Hour()), 10)
534	b = append(b, gsw.timeSeparator...)
535
536	if t.Minute() < 10 {
537		b = append(b, '0')
538	}
539
540	b = strconv.AppendInt(b, int64(t.Minute()), 10)
541
542	return string(b)
543}
544
545// FmtTimeMedium returns the medium time representation of 't' for 'gsw_CH'
546func (gsw *gsw_CH) FmtTimeMedium(t time.Time) string {
547
548	b := make([]byte, 0, 32)
549
550	if t.Hour() < 10 {
551		b = append(b, '0')
552	}
553
554	b = strconv.AppendInt(b, int64(t.Hour()), 10)
555	b = append(b, gsw.timeSeparator...)
556
557	if t.Minute() < 10 {
558		b = append(b, '0')
559	}
560
561	b = strconv.AppendInt(b, int64(t.Minute()), 10)
562	b = append(b, gsw.timeSeparator...)
563
564	if t.Second() < 10 {
565		b = append(b, '0')
566	}
567
568	b = strconv.AppendInt(b, int64(t.Second()), 10)
569
570	return string(b)
571}
572
573// FmtTimeLong returns the long time representation of 't' for 'gsw_CH'
574func (gsw *gsw_CH) FmtTimeLong(t time.Time) string {
575
576	b := make([]byte, 0, 32)
577
578	if t.Hour() < 10 {
579		b = append(b, '0')
580	}
581
582	b = strconv.AppendInt(b, int64(t.Hour()), 10)
583	b = append(b, gsw.timeSeparator...)
584
585	if t.Minute() < 10 {
586		b = append(b, '0')
587	}
588
589	b = strconv.AppendInt(b, int64(t.Minute()), 10)
590	b = append(b, gsw.timeSeparator...)
591
592	if t.Second() < 10 {
593		b = append(b, '0')
594	}
595
596	b = strconv.AppendInt(b, int64(t.Second()), 10)
597	b = append(b, []byte{0x20}...)
598
599	tz, _ := t.Zone()
600	b = append(b, tz...)
601
602	return string(b)
603}
604
605// FmtTimeFull returns the full time representation of 't' for 'gsw_CH'
606func (gsw *gsw_CH) FmtTimeFull(t time.Time) string {
607
608	b := make([]byte, 0, 32)
609
610	if t.Hour() < 10 {
611		b = append(b, '0')
612	}
613
614	b = strconv.AppendInt(b, int64(t.Hour()), 10)
615	b = append(b, gsw.timeSeparator...)
616
617	if t.Minute() < 10 {
618		b = append(b, '0')
619	}
620
621	b = strconv.AppendInt(b, int64(t.Minute()), 10)
622	b = append(b, gsw.timeSeparator...)
623
624	if t.Second() < 10 {
625		b = append(b, '0')
626	}
627
628	b = strconv.AppendInt(b, int64(t.Second()), 10)
629	b = append(b, []byte{0x20}...)
630
631	tz, _ := t.Zone()
632
633	if btz, ok := gsw.timezones[tz]; ok {
634		b = append(b, btz...)
635	} else {
636		b = append(b, tz...)
637	}
638
639	return string(b)
640}
641