1package os
2
3import (
4	"math"
5	"strconv"
6	"time"
7
8	"github.com/go-playground/locales"
9	"github.com/go-playground/locales/currency"
10)
11
12type os 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	perMille               string
22	timeSeparator          string
23	inifinity              string
24	currencies             []string // idx = enum of currency code
25	currencyPositivePrefix string
26	currencyNegativePrefix string
27	monthsAbbreviated      []string
28	monthsNarrow           []string
29	monthsWide             []string
30	daysAbbreviated        []string
31	daysNarrow             []string
32	daysShort              []string
33	daysWide               []string
34	periodsAbbreviated     []string
35	periodsNarrow          []string
36	periodsShort           []string
37	periodsWide            []string
38	erasAbbreviated        []string
39	erasNarrow             []string
40	erasWide               []string
41	timezones              map[string]string
42}
43
44// New returns a new instance of translator for the 'os' locale
45func New() locales.Translator {
46	return &os{
47		locale:                 "os",
48		pluralsCardinal:        []locales.PluralRule{2, 6},
49		pluralsOrdinal:         nil,
50		pluralsRange:           nil,
51		decimal:                ",",
52		group:                  " ",
53		minus:                  "-",
54		percent:                "%",
55		perMille:               "‰",
56		timeSeparator:          ":",
57		inifinity:              "∞",
58		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", "R$", "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", "€", "FIM", "FJD", "FKP", "FRF", "£", "GEK", "₾", "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", "STN", "SUR", "SVC", "SYP", "SZL", "THB", "TJR", "TJS", "TMM", "TMT", "TND", "TOP", "TPE", "TRL", "TRY", "TTD", "TWD", "TZS", "UAH", "UAK", "UGS", "UGX", "$", "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"},
59		currencyPositivePrefix: " ",
60		currencyNegativePrefix: " ",
61		monthsAbbreviated:      []string{"", "янв.", "фев.", "мар.", "апр.", "майы", "июны", "июлы", "авг.", "сен.", "окт.", "ноя.", "дек."},
62		monthsNarrow:           []string{"", "Я", "Ф", "М", "А", "М", "И", "И", "А", "С", "О", "Н", "Д"},
63		monthsWide:             []string{"", "январы", "февралы", "мартъийы", "апрелы", "майы", "июны", "июлы", "августы", "сентябры", "октябры", "ноябры", "декабры"},
64		daysAbbreviated:        []string{"хцб", "крс", "дцг", "ӕрт", "цпр", "мрб", "сбт"},
65		daysNarrow:             []string{"Х", "К", "Д", "Ӕ", "Ц", "М", "С"},
66		daysWide:               []string{"хуыцаубон", "къуырисӕр", "дыццӕг", "ӕртыццӕг", "цыппӕрӕм", "майрӕмбон", "сабат"},
67		periodsAbbreviated:     []string{"AM", "PM"},
68		periodsWide:            []string{"ӕмбисбоны размӕ", "ӕмбисбоны фӕстӕ"},
69		erasAbbreviated:        []string{"н.д.а.", "н.д."},
70		erasNarrow:             []string{"", ""},
71		erasWide:               []string{"", ""},
72		timezones:              map[string]string{"CAT": "CAT", "HNCU": "HNCU", "ACDT": "ACDT", "HNOG": "HNOG", "COT": "COT", "∅∅∅": "∅∅∅", "AWST": "AWST", "NZDT": "NZDT", "GFT": "GFT", "JDT": "JDT", "ECT": "ECT", "HKST": "HKST", "HEPM": "HEPM", "CLST": "CLST", "HADT": "HADT", "GMT": "Гринвичы рӕстӕмбис рӕстӕг", "EDT": "EDT", "ACWST": "ACWST", "LHST": "LHST", "HNT": "HNT", "MDT": "MDT", "SRT": "SRT", "OEZ": "Скӕсӕн Европӕйаг стандартон рӕстӕг", "ARST": "ARST", "COST": "COST", "ADT": "ADT", "HEOG": "HEOG", "EAT": "EAT", "CST": "CST", "CDT": "CDT", "SGT": "SGT", "HNNOMX": "HNNOMX", "OESZ": "Скӕсӕн Европӕйаг сӕрдыгон рӕстӕг", "UYT": "UYT", "AEST": "AEST", "WAT": "WAT", "HEEG": "HEEG", "TMT": "TMT", "HAST": "HAST", "ChST": "ChST", "WARST": "WARST", "WITA": "WITA", "WIT": "WIT", "PST": "PST", "JST": "JST", "CHADT": "CHADT", "WESZ": "Ныгъуылӕн Европӕйаг сӕрдыгон рӕстӕг", "WIB": "WIB", "BT": "BT", "MYT": "MYT", "HNEG": "HNEG", "HAT": "HAT", "CHAST": "CHAST", "AWDT": "AWDT", "WAST": "WAST", "ACWDT": "ACWDT", "VET": "VET", "AST": "AST", "AEDT": "AEDT", "WEZ": "Ныгъуылӕн Европӕйаг стандартон рӕстӕг", "EST": "EST", "MEZ": "Астӕуккаг Европӕйаг стандартон рӕстӕг", "LHDT": "LHDT", "ART": "ART", "GYT": "GYT", "UYST": "UYST", "AKST": "AKST", "ACST": "ACST", "HNPM": "HNPM", "CLT": "CLT", "TMST": "TMST", "HNPMX": "HNPMX", "AKDT": "AKDT", "IST": "IST", "WART": "WART", "MST": "MST", "PDT": "PDT", "HEPMX": "HEPMX", "NZST": "NZST", "BOT": "BOT", "MESZ": "Астӕуккаг Европӕйаг сӕрдыгон рӕстӕг", "HKT": "HKT", "HENOMX": "HENOMX", "HECU": "HECU", "SAST": "SAST"},
73	}
74}
75
76// Locale returns the current translators string locale
77func (os *os) Locale() string {
78	return os.locale
79}
80
81// PluralsCardinal returns the list of cardinal plural rules associated with 'os'
82func (os *os) PluralsCardinal() []locales.PluralRule {
83	return os.pluralsCardinal
84}
85
86// PluralsOrdinal returns the list of ordinal plural rules associated with 'os'
87func (os *os) PluralsOrdinal() []locales.PluralRule {
88	return os.pluralsOrdinal
89}
90
91// PluralsRange returns the list of range plural rules associated with 'os'
92func (os *os) PluralsRange() []locales.PluralRule {
93	return os.pluralsRange
94}
95
96// CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'os'
97func (os *os) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
98
99	n := math.Abs(num)
100
101	if n == 1 {
102		return locales.PluralRuleOne
103	}
104
105	return locales.PluralRuleOther
106}
107
108// OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'os'
109func (os *os) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
110	return locales.PluralRuleUnknown
111}
112
113// RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'os'
114func (os *os) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
115	return locales.PluralRuleUnknown
116}
117
118// MonthAbbreviated returns the locales abbreviated month given the 'month' provided
119func (os *os) MonthAbbreviated(month time.Month) string {
120	return os.monthsAbbreviated[month]
121}
122
123// MonthsAbbreviated returns the locales abbreviated months
124func (os *os) MonthsAbbreviated() []string {
125	return os.monthsAbbreviated[1:]
126}
127
128// MonthNarrow returns the locales narrow month given the 'month' provided
129func (os *os) MonthNarrow(month time.Month) string {
130	return os.monthsNarrow[month]
131}
132
133// MonthsNarrow returns the locales narrow months
134func (os *os) MonthsNarrow() []string {
135	return os.monthsNarrow[1:]
136}
137
138// MonthWide returns the locales wide month given the 'month' provided
139func (os *os) MonthWide(month time.Month) string {
140	return os.monthsWide[month]
141}
142
143// MonthsWide returns the locales wide months
144func (os *os) MonthsWide() []string {
145	return os.monthsWide[1:]
146}
147
148// WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
149func (os *os) WeekdayAbbreviated(weekday time.Weekday) string {
150	return os.daysAbbreviated[weekday]
151}
152
153// WeekdaysAbbreviated returns the locales abbreviated weekdays
154func (os *os) WeekdaysAbbreviated() []string {
155	return os.daysAbbreviated
156}
157
158// WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
159func (os *os) WeekdayNarrow(weekday time.Weekday) string {
160	return os.daysNarrow[weekday]
161}
162
163// WeekdaysNarrow returns the locales narrow weekdays
164func (os *os) WeekdaysNarrow() []string {
165	return os.daysNarrow
166}
167
168// WeekdayShort returns the locales short weekday given the 'weekday' provided
169func (os *os) WeekdayShort(weekday time.Weekday) string {
170	return os.daysShort[weekday]
171}
172
173// WeekdaysShort returns the locales short weekdays
174func (os *os) WeekdaysShort() []string {
175	return os.daysShort
176}
177
178// WeekdayWide returns the locales wide weekday given the 'weekday' provided
179func (os *os) WeekdayWide(weekday time.Weekday) string {
180	return os.daysWide[weekday]
181}
182
183// WeekdaysWide returns the locales wide weekdays
184func (os *os) WeekdaysWide() []string {
185	return os.daysWide
186}
187
188// Decimal returns the decimal point of number
189func (os *os) Decimal() string {
190	return os.decimal
191}
192
193// Group returns the group of number
194func (os *os) Group() string {
195	return os.group
196}
197
198// Group returns the minus sign of number
199func (os *os) Minus() string {
200	return os.minus
201}
202
203// FmtNumber returns 'num' with digits/precision of 'v' for 'os' and handles both Whole and Real numbers based on 'v'
204func (os *os) FmtNumber(num float64, v uint64) string {
205
206	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
207	l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
208	count := 0
209	inWhole := v == 0
210	b := make([]byte, 0, l)
211
212	for i := len(s) - 1; i >= 0; i-- {
213
214		if s[i] == '.' {
215			b = append(b, os.decimal[0])
216			inWhole = true
217			continue
218		}
219
220		if inWhole {
221			if count == 3 {
222				for j := len(os.group) - 1; j >= 0; j-- {
223					b = append(b, os.group[j])
224				}
225				count = 1
226			} else {
227				count++
228			}
229		}
230
231		b = append(b, s[i])
232	}
233
234	if num < 0 {
235		b = append(b, os.minus[0])
236	}
237
238	// reverse
239	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
240		b[i], b[j] = b[j], b[i]
241	}
242
243	return string(b)
244}
245
246// FmtPercent returns 'num' with digits/precision of 'v' for 'os' and handles both Whole and Real numbers based on 'v'
247// NOTE: 'num' passed into FmtPercent is assumed to be in percent already
248func (os *os) FmtPercent(num float64, v uint64) string {
249	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
250	l := len(s) + 3
251	b := make([]byte, 0, l)
252
253	for i := len(s) - 1; i >= 0; i-- {
254
255		if s[i] == '.' {
256			b = append(b, os.decimal[0])
257			continue
258		}
259
260		b = append(b, s[i])
261	}
262
263	if num < 0 {
264		b = append(b, os.minus[0])
265	}
266
267	// reverse
268	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
269		b[i], b[j] = b[j], b[i]
270	}
271
272	b = append(b, os.percent...)
273
274	return string(b)
275}
276
277// FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'os'
278func (os *os) FmtCurrency(num float64, v uint64, currency currency.Type) string {
279
280	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
281	symbol := os.currencies[currency]
282	l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
283	count := 0
284	inWhole := v == 0
285	b := make([]byte, 0, l)
286
287	for i := len(s) - 1; i >= 0; i-- {
288
289		if s[i] == '.' {
290			b = append(b, os.decimal[0])
291			inWhole = true
292			continue
293		}
294
295		if inWhole {
296			if count == 3 {
297				for j := len(os.group) - 1; j >= 0; j-- {
298					b = append(b, os.group[j])
299				}
300				count = 1
301			} else {
302				count++
303			}
304		}
305
306		b = append(b, s[i])
307	}
308
309	for j := len(symbol) - 1; j >= 0; j-- {
310		b = append(b, symbol[j])
311	}
312
313	for j := len(os.currencyPositivePrefix) - 1; j >= 0; j-- {
314		b = append(b, os.currencyPositivePrefix[j])
315	}
316
317	if num < 0 {
318		b = append(b, os.minus[0])
319	}
320
321	// reverse
322	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
323		b[i], b[j] = b[j], b[i]
324	}
325
326	if int(v) < 2 {
327
328		if v == 0 {
329			b = append(b, os.decimal...)
330		}
331
332		for i := 0; i < 2-int(v); i++ {
333			b = append(b, '0')
334		}
335	}
336
337	return string(b)
338}
339
340// FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'os'
341// in accounting notation.
342func (os *os) FmtAccounting(num float64, v uint64, currency currency.Type) string {
343
344	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
345	symbol := os.currencies[currency]
346	l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
347	count := 0
348	inWhole := v == 0
349	b := make([]byte, 0, l)
350
351	for i := len(s) - 1; i >= 0; i-- {
352
353		if s[i] == '.' {
354			b = append(b, os.decimal[0])
355			inWhole = true
356			continue
357		}
358
359		if inWhole {
360			if count == 3 {
361				for j := len(os.group) - 1; j >= 0; j-- {
362					b = append(b, os.group[j])
363				}
364				count = 1
365			} else {
366				count++
367			}
368		}
369
370		b = append(b, s[i])
371	}
372
373	if num < 0 {
374
375		for j := len(symbol) - 1; j >= 0; j-- {
376			b = append(b, symbol[j])
377		}
378
379		for j := len(os.currencyNegativePrefix) - 1; j >= 0; j-- {
380			b = append(b, os.currencyNegativePrefix[j])
381		}
382
383		b = append(b, os.minus[0])
384
385	} else {
386
387		for j := len(symbol) - 1; j >= 0; j-- {
388			b = append(b, symbol[j])
389		}
390
391		for j := len(os.currencyPositivePrefix) - 1; j >= 0; j-- {
392			b = append(b, os.currencyPositivePrefix[j])
393		}
394
395	}
396
397	// reverse
398	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
399		b[i], b[j] = b[j], b[i]
400	}
401
402	if int(v) < 2 {
403
404		if v == 0 {
405			b = append(b, os.decimal...)
406		}
407
408		for i := 0; i < 2-int(v); i++ {
409			b = append(b, '0')
410		}
411	}
412
413	return string(b)
414}
415
416// FmtDateShort returns the short date representation of 't' for 'os'
417func (os *os) FmtDateShort(t time.Time) string {
418
419	b := make([]byte, 0, 32)
420
421	if t.Day() < 10 {
422		b = append(b, '0')
423	}
424
425	b = strconv.AppendInt(b, int64(t.Day()), 10)
426	b = append(b, []byte{0x2e}...)
427
428	if t.Month() < 10 {
429		b = append(b, '0')
430	}
431
432	b = strconv.AppendInt(b, int64(t.Month()), 10)
433
434	b = append(b, []byte{0x2e}...)
435
436	if t.Year() > 9 {
437		b = append(b, strconv.Itoa(t.Year())[2:]...)
438	} else {
439		b = append(b, strconv.Itoa(t.Year())[1:]...)
440	}
441
442	return string(b)
443}
444
445// FmtDateMedium returns the medium date representation of 't' for 'os'
446func (os *os) FmtDateMedium(t time.Time) string {
447
448	b := make([]byte, 0, 32)
449
450	if t.Day() < 10 {
451		b = append(b, '0')
452	}
453
454	b = strconv.AppendInt(b, int64(t.Day()), 10)
455	b = append(b, []byte{0x20}...)
456	b = append(b, os.monthsAbbreviated[t.Month()]...)
457	b = append(b, []byte{0x20}...)
458
459	if t.Year() > 0 {
460		b = strconv.AppendInt(b, int64(t.Year()), 10)
461	} else {
462		b = strconv.AppendInt(b, int64(-t.Year()), 10)
463	}
464
465	b = append(b, []byte{0x20, 0xd0, 0xb0, 0xd0, 0xb7}...)
466
467	return string(b)
468}
469
470// FmtDateLong returns the long date representation of 't' for 'os'
471func (os *os) FmtDateLong(t time.Time) string {
472
473	b := make([]byte, 0, 32)
474
475	b = strconv.AppendInt(b, int64(t.Day()), 10)
476	b = append(b, []byte{0x20}...)
477	b = append(b, os.monthsWide[t.Month()]...)
478	b = append(b, []byte{0x2c, 0x20}...)
479
480	if t.Year() > 0 {
481		b = strconv.AppendInt(b, int64(t.Year()), 10)
482	} else {
483		b = strconv.AppendInt(b, int64(-t.Year()), 10)
484	}
485
486	b = append(b, []byte{0x20, 0xd0, 0xb0, 0xd0, 0xb7}...)
487
488	return string(b)
489}
490
491// FmtDateFull returns the full date representation of 't' for 'os'
492func (os *os) FmtDateFull(t time.Time) string {
493
494	b := make([]byte, 0, 32)
495
496	b = append(b, os.daysWide[t.Weekday()]...)
497	b = append(b, []byte{0x2c, 0x20}...)
498	b = strconv.AppendInt(b, int64(t.Day()), 10)
499	b = append(b, []byte{0x20}...)
500	b = append(b, os.monthsWide[t.Month()]...)
501	b = append(b, []byte{0x2c, 0x20}...)
502
503	if t.Year() > 0 {
504		b = strconv.AppendInt(b, int64(t.Year()), 10)
505	} else {
506		b = strconv.AppendInt(b, int64(-t.Year()), 10)
507	}
508
509	b = append(b, []byte{0x20, 0xd0, 0xb0, 0xd0, 0xb7}...)
510
511	return string(b)
512}
513
514// FmtTimeShort returns the short time representation of 't' for 'os'
515func (os *os) FmtTimeShort(t time.Time) string {
516
517	b := make([]byte, 0, 32)
518
519	if t.Hour() < 10 {
520		b = append(b, '0')
521	}
522
523	b = strconv.AppendInt(b, int64(t.Hour()), 10)
524	b = append(b, os.timeSeparator...)
525
526	if t.Minute() < 10 {
527		b = append(b, '0')
528	}
529
530	b = strconv.AppendInt(b, int64(t.Minute()), 10)
531
532	return string(b)
533}
534
535// FmtTimeMedium returns the medium time representation of 't' for 'os'
536func (os *os) FmtTimeMedium(t time.Time) string {
537
538	b := make([]byte, 0, 32)
539
540	if t.Hour() < 10 {
541		b = append(b, '0')
542	}
543
544	b = strconv.AppendInt(b, int64(t.Hour()), 10)
545	b = append(b, os.timeSeparator...)
546
547	if t.Minute() < 10 {
548		b = append(b, '0')
549	}
550
551	b = strconv.AppendInt(b, int64(t.Minute()), 10)
552	b = append(b, os.timeSeparator...)
553
554	if t.Second() < 10 {
555		b = append(b, '0')
556	}
557
558	b = strconv.AppendInt(b, int64(t.Second()), 10)
559
560	return string(b)
561}
562
563// FmtTimeLong returns the long time representation of 't' for 'os'
564func (os *os) FmtTimeLong(t time.Time) string {
565
566	b := make([]byte, 0, 32)
567
568	if t.Hour() < 10 {
569		b = append(b, '0')
570	}
571
572	b = strconv.AppendInt(b, int64(t.Hour()), 10)
573	b = append(b, os.timeSeparator...)
574
575	if t.Minute() < 10 {
576		b = append(b, '0')
577	}
578
579	b = strconv.AppendInt(b, int64(t.Minute()), 10)
580	b = append(b, os.timeSeparator...)
581
582	if t.Second() < 10 {
583		b = append(b, '0')
584	}
585
586	b = strconv.AppendInt(b, int64(t.Second()), 10)
587	b = append(b, []byte{0x20}...)
588
589	tz, _ := t.Zone()
590	b = append(b, tz...)
591
592	return string(b)
593}
594
595// FmtTimeFull returns the full time representation of 't' for 'os'
596func (os *os) FmtTimeFull(t time.Time) string {
597
598	b := make([]byte, 0, 32)
599
600	if t.Hour() < 10 {
601		b = append(b, '0')
602	}
603
604	b = strconv.AppendInt(b, int64(t.Hour()), 10)
605	b = append(b, os.timeSeparator...)
606
607	if t.Minute() < 10 {
608		b = append(b, '0')
609	}
610
611	b = strconv.AppendInt(b, int64(t.Minute()), 10)
612	b = append(b, os.timeSeparator...)
613
614	if t.Second() < 10 {
615		b = append(b, '0')
616	}
617
618	b = strconv.AppendInt(b, int64(t.Second()), 10)
619	b = append(b, []byte{0x20}...)
620
621	tz, _ := t.Zone()
622
623	if btz, ok := os.timezones[tz]; ok {
624		b = append(b, btz...)
625	} else {
626		b = append(b, tz...)
627	}
628
629	return string(b)
630}
631