1 package tk_TM
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 tk_TM 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
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
46 func New() locales.Translator {
47 return &tk_TM{
48 locale: "tk_TM",
49 pluralsCardinal: []locales.PluralRule{2, 6},
50 pluralsOrdinal: []locales.PluralRule{4, 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{"", "ýan", "few", "mart", "apr", "maý", "iýun", "iýul", "awg", "sen", "okt", "noý", "dek"},
64 monthsNarrow: []string{"", "Ý", "F", "M", "A", "M", "I", "I", "A", "S", "O", "N", "D"},
65 monthsWide: []string{"", "ýanwar", "fewral", "mart", "aprel", "maý", "iýun", "iýul", "awgust", "sentýabr", "oktýabr", "noýabr", "dekabr"},
66 daysAbbreviated: []string{"ýek", "duş", "siş", "çar", "pen", "ann", "şen"},
67 daysNarrow: []string{"Ý", "D", "S", "Ç", "P", "A", "Ş"},
68 daysShort: []string{"ýb", "db", "sb", "çb", "pb", "an", "şb"},
69 daysWide: []string{"ýekşenbe", "duşenbe", "sişenbe", "çarşenbe", "penşenbe", "anna", "şenbe"},
70 periodsAbbreviated: []string{"go.öň", "go.soň"},
71 periodsNarrow: []string{"öň", "soň"},
72 periodsWide: []string{"günortadan öň", "günortadan soň"},
73 erasAbbreviated: []string{"B.e.öň", "B.e."},
74 erasNarrow: []string{"", ""},
75 erasWide: []string{"Isadan öň", "Isadan soň"},
76 timezones: map[string]string{"ACDT": "Merkezi Awstraliýa tomusky wagty", "ACST": "Merkezi Awstraliýa standart wagty", "ACWDT": "Merkezi Awstraliýa günbatar tomusky wagty", "ACWST": "Merkezi Awstraliýa günbatar standart wagty", "ADT": "Atlantik tomusky wagty", "AEDT": "Gündogar Awstraliýa tomusky wagty", "AEST": "Gündogar Awstraliýa standart wagty", "AKDT": "Alýaska tomusky wagty", "AKST": "Alýaska standart wagty", "ARST": "Argentina tomusky wagty", "ART": "Argentina standart wagty", "AST": "Atlantik standart wagty", "AWDT": "Günbatar Awstraliýa tomusky wagty", "AWST": "Günbatar Awstraliýa standart wagty", "BOT": "Boliwiýa wagty", "BT": "Butan wagty", "CAT": "Merkezi Afrika wagty", "CDT": "Merkezi Amerika tomusky wagty", "CHADT": "Çatem tomusky wagty", "CHAST": "Çatem standart wagty", "CLST": "Çili tomusky wagty", "CLT": "Çili standart wagty", "COST": "Kolumbiýa tomusky wagty", "COT": "Kolumbiýa standart wagty", "CST": "Merkezi Amerika standart wagty", "ChST": "Çamorro wagty", "EAT": "Gündogar Afrika wagty", "ECT": "Ekwador wagty", "EDT": "Demirgazyk Amerika gündogar tomusky wagty", "EST": "Demirgazyk Amerika gündogar standart wagty", "GFT": "Fransuz Gwianasy wagty", "GMT": "Grinwiç boýunça orta wagt", "GST": "Pars aýlagy standart wagty", "GYT": "Gaýana wagty", "HADT": "Gawaý-Aleut tomusky wagty", "HAST": "Gawaý-Aleut standart wagty", "HAT": "Nýufaundlend tomusky wagty", "HECU": "Kuba tomusky wagty", "HEEG": "Gündogar Grenlandiýa tomusky wagty", "HENOMX": "Demirgazyk-günbatar Meksika tomusky wagty", "HEOG": "Günbatar Grenlandiýa tomusky wagty", "HEPM": "Sen-Pýer we Mikelon tomusky wagty", "HEPMX": "Meksikan Ýuwaş umman tomusky wagty", "HKST": "Gonkong tomusky wagty", "HKT": "Gonkong standart wagty", "HNCU": "Kuba standart wagty", "HNEG": "Gündogar Grenlandiýa standart wagty", "HNNOMX": "Demirgazyk-günbatar Meksika standart wagty", "HNOG": "Günbatar Grenlandiýa standart wagty", "HNPM": "Sen-Pýer we Mikelon standart wagty", "HNPMX": "Meksikan Ýuwaş umman standart wagty", "HNT": "Nýufaundlend standart wagty", "IST": "Hindistan standart wagty", "JDT": "Ýaponiýa tomusky wagty", "JST": "Ýaponiýa standart wagty", "LHDT": "Lord-Hau tomusky wagty", "LHST": "Lord-Hau standart wagty", "MDT": "Demirgazyk Amerika dag tomusky wagty", "MESZ": "Merkezi Ýewropa tomusky wagty", "MEZ": "Merkezi Ýewropa standart wagty", "MST": "Demirgazyk Amerika dag standart wagty", "MYT": "Malaýziýa wagty", "NZDT": "Täze Zelandiýa tomusky wagty", "NZST": "Täze Zelandiýa standart wagty", "OESZ": "Gündogar Ýewropa tomusky wagty", "OEZ": "Gündogar Ýewropa standart wagty", "PDT": "Demirgazyk Amerika Ýuwaş umman tomusky wagty", "PST": "Demirgazyk Amerika Ýuwaş umman standart wagty", "SAST": "Günorta Afrika standart wagty", "SGT": "Singapur wagty", "SRT": "Surinam wagty", "TMST": "Türkmenistan tomusky wagty", "TMT": "Türkmenistan standart wagty", "UYST": "Urugwaý tomusky wagty", "UYT": "Urugwaý standart wagty", "VET": "Wenesuela wagty", "WARST": "Günbatar Argentina tomusky wagty", "WART": "Günbatar Argentina standart wagty", "WAST": "Günbatar Afrika tomusky wagty", "WAT": "Günbatar Afrika standart wagty", "WESZ": "Günbatar Ýewropa tomusky wagty", "WEZ": "Günbatar Ýewropa standart wagty", "WIB": "Günbatar Indoneziýa wagty", "WIT": "Gündogar Indoneziýa wagty", "WITA": "Merkezi Indoneziýa wagty", "∅∅∅": "Braziliýa tomusky wagty"},
77 }
78 }
79
80
81 func (tk *tk_TM) Locale() string {
82 return tk.locale
83 }
84
85
86 func (tk *tk_TM) PluralsCardinal() []locales.PluralRule {
87 return tk.pluralsCardinal
88 }
89
90
91 func (tk *tk_TM) PluralsOrdinal() []locales.PluralRule {
92 return tk.pluralsOrdinal
93 }
94
95
96 func (tk *tk_TM) PluralsRange() []locales.PluralRule {
97 return tk.pluralsRange
98 }
99
100
101 func (tk *tk_TM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
102
103 n := math.Abs(num)
104
105 if n == 1 {
106 return locales.PluralRuleOne
107 }
108
109 return locales.PluralRuleOther
110 }
111
112
113 func (tk *tk_TM) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
114
115 n := math.Abs(num)
116 nMod10 := math.Mod(n, 10)
117
118 if (nMod10 == 6 || nMod10 == 9) || (n == 10) {
119 return locales.PluralRuleFew
120 }
121
122 return locales.PluralRuleOther
123 }
124
125
126 func (tk *tk_TM) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
127
128 start := tk.CardinalPluralRule(num1, v1)
129 end := tk.CardinalPluralRule(num2, v2)
130
131 if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
132 return locales.PluralRuleOther
133 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
134 return locales.PluralRuleOne
135 }
136
137 return locales.PluralRuleOther
138
139 }
140
141
142 func (tk *tk_TM) MonthAbbreviated(month time.Month) string {
143 return tk.monthsAbbreviated[month]
144 }
145
146
147 func (tk *tk_TM) MonthsAbbreviated() []string {
148 return tk.monthsAbbreviated[1:]
149 }
150
151
152 func (tk *tk_TM) MonthNarrow(month time.Month) string {
153 return tk.monthsNarrow[month]
154 }
155
156
157 func (tk *tk_TM) MonthsNarrow() []string {
158 return tk.monthsNarrow[1:]
159 }
160
161
162 func (tk *tk_TM) MonthWide(month time.Month) string {
163 return tk.monthsWide[month]
164 }
165
166
167 func (tk *tk_TM) MonthsWide() []string {
168 return tk.monthsWide[1:]
169 }
170
171
172 func (tk *tk_TM) WeekdayAbbreviated(weekday time.Weekday) string {
173 return tk.daysAbbreviated[weekday]
174 }
175
176
177 func (tk *tk_TM) WeekdaysAbbreviated() []string {
178 return tk.daysAbbreviated
179 }
180
181
182 func (tk *tk_TM) WeekdayNarrow(weekday time.Weekday) string {
183 return tk.daysNarrow[weekday]
184 }
185
186
187 func (tk *tk_TM) WeekdaysNarrow() []string {
188 return tk.daysNarrow
189 }
190
191
192 func (tk *tk_TM) WeekdayShort(weekday time.Weekday) string {
193 return tk.daysShort[weekday]
194 }
195
196
197 func (tk *tk_TM) WeekdaysShort() []string {
198 return tk.daysShort
199 }
200
201
202 func (tk *tk_TM) WeekdayWide(weekday time.Weekday) string {
203 return tk.daysWide[weekday]
204 }
205
206
207 func (tk *tk_TM) WeekdaysWide() []string {
208 return tk.daysWide
209 }
210
211
212 func (tk *tk_TM) Decimal() string {
213 return tk.decimal
214 }
215
216
217 func (tk *tk_TM) Group() string {
218 return tk.group
219 }
220
221
222 func (tk *tk_TM) Minus() string {
223 return tk.minus
224 }
225
226
227 func (tk *tk_TM) FmtNumber(num float64, v uint64) string {
228
229 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
230 l := len(s) + 2 + 2*len(s[:len(s)-int(v)-1])/3
231 count := 0
232 inWhole := v == 0
233 b := make([]byte, 0, l)
234
235 for i := len(s) - 1; i >= 0; i-- {
236
237 if s[i] == '.' {
238 b = append(b, tk.decimal[0])
239 inWhole = true
240 continue
241 }
242
243 if inWhole {
244 if count == 3 {
245 for j := len(tk.group) - 1; j >= 0; j-- {
246 b = append(b, tk.group[j])
247 }
248 count = 1
249 } else {
250 count++
251 }
252 }
253
254 b = append(b, s[i])
255 }
256
257 if num < 0 {
258 b = append(b, tk.minus[0])
259 }
260
261
262 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
263 b[i], b[j] = b[j], b[i]
264 }
265
266 return string(b)
267 }
268
269
270
271 func (tk *tk_TM) FmtPercent(num float64, v uint64) string {
272 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
273 l := len(s) + 5
274 b := make([]byte, 0, l)
275
276 for i := len(s) - 1; i >= 0; i-- {
277
278 if s[i] == '.' {
279 b = append(b, tk.decimal[0])
280 continue
281 }
282
283 b = append(b, s[i])
284 }
285
286 if num < 0 {
287 b = append(b, tk.minus[0])
288 }
289
290
291 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
292 b[i], b[j] = b[j], b[i]
293 }
294
295 b = append(b, tk.percentSuffix...)
296
297 b = append(b, tk.percent...)
298
299 return string(b)
300 }
301
302
303 func (tk *tk_TM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
304
305 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
306 symbol := tk.currencies[currency]
307 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
308 count := 0
309 inWhole := v == 0
310 b := make([]byte, 0, l)
311
312 for i := len(s) - 1; i >= 0; i-- {
313
314 if s[i] == '.' {
315 b = append(b, tk.decimal[0])
316 inWhole = true
317 continue
318 }
319
320 if inWhole {
321 if count == 3 {
322 for j := len(tk.group) - 1; j >= 0; j-- {
323 b = append(b, tk.group[j])
324 }
325 count = 1
326 } else {
327 count++
328 }
329 }
330
331 b = append(b, s[i])
332 }
333
334 if num < 0 {
335 b = append(b, tk.minus[0])
336 }
337
338
339 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
340 b[i], b[j] = b[j], b[i]
341 }
342
343 if int(v) < 2 {
344
345 if v == 0 {
346 b = append(b, tk.decimal...)
347 }
348
349 for i := 0; i < 2-int(v); i++ {
350 b = append(b, '0')
351 }
352 }
353
354 b = append(b, tk.currencyPositiveSuffix...)
355
356 b = append(b, symbol...)
357
358 return string(b)
359 }
360
361
362
363 func (tk *tk_TM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
364
365 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
366 symbol := tk.currencies[currency]
367 l := len(s) + len(symbol) + 4 + 2*len(s[:len(s)-int(v)-1])/3
368 count := 0
369 inWhole := v == 0
370 b := make([]byte, 0, l)
371
372 for i := len(s) - 1; i >= 0; i-- {
373
374 if s[i] == '.' {
375 b = append(b, tk.decimal[0])
376 inWhole = true
377 continue
378 }
379
380 if inWhole {
381 if count == 3 {
382 for j := len(tk.group) - 1; j >= 0; j-- {
383 b = append(b, tk.group[j])
384 }
385 count = 1
386 } else {
387 count++
388 }
389 }
390
391 b = append(b, s[i])
392 }
393
394 if num < 0 {
395
396 b = append(b, tk.minus[0])
397
398 }
399
400
401 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
402 b[i], b[j] = b[j], b[i]
403 }
404
405 if int(v) < 2 {
406
407 if v == 0 {
408 b = append(b, tk.decimal...)
409 }
410
411 for i := 0; i < 2-int(v); i++ {
412 b = append(b, '0')
413 }
414 }
415
416 if num < 0 {
417 b = append(b, tk.currencyNegativeSuffix...)
418 b = append(b, symbol...)
419 } else {
420
421 b = append(b, tk.currencyPositiveSuffix...)
422 b = append(b, symbol...)
423 }
424
425 return string(b)
426 }
427
428
429 func (tk *tk_TM) FmtDateShort(t time.Time) string {
430
431 b := make([]byte, 0, 32)
432
433 if t.Day() < 10 {
434 b = append(b, '0')
435 }
436
437 b = strconv.AppendInt(b, int64(t.Day()), 10)
438 b = append(b, []byte{0x2e}...)
439
440 if t.Month() < 10 {
441 b = append(b, '0')
442 }
443
444 b = strconv.AppendInt(b, int64(t.Month()), 10)
445
446 b = append(b, []byte{0x2e}...)
447
448 if t.Year() > 0 {
449 b = strconv.AppendInt(b, int64(t.Year()), 10)
450 } else {
451 b = strconv.AppendInt(b, int64(-t.Year()), 10)
452 }
453
454 return string(b)
455 }
456
457
458 func (tk *tk_TM) FmtDateMedium(t time.Time) string {
459
460 b := make([]byte, 0, 32)
461
462 b = strconv.AppendInt(b, int64(t.Day()), 10)
463 b = append(b, []byte{0x20}...)
464 b = append(b, tk.monthsAbbreviated[t.Month()]...)
465 b = append(b, []byte{0x20}...)
466
467 if t.Year() > 0 {
468 b = strconv.AppendInt(b, int64(t.Year()), 10)
469 } else {
470 b = strconv.AppendInt(b, int64(-t.Year()), 10)
471 }
472
473 return string(b)
474 }
475
476
477 func (tk *tk_TM) FmtDateLong(t time.Time) string {
478
479 b := make([]byte, 0, 32)
480
481 b = strconv.AppendInt(b, int64(t.Day()), 10)
482 b = append(b, []byte{0x20}...)
483 b = append(b, tk.monthsWide[t.Month()]...)
484 b = append(b, []byte{0x20}...)
485
486 if t.Year() > 0 {
487 b = strconv.AppendInt(b, int64(t.Year()), 10)
488 } else {
489 b = strconv.AppendInt(b, int64(-t.Year()), 10)
490 }
491
492 return string(b)
493 }
494
495
496 func (tk *tk_TM) FmtDateFull(t time.Time) string {
497
498 b := make([]byte, 0, 32)
499
500 b = strconv.AppendInt(b, int64(t.Day()), 10)
501 b = append(b, []byte{0x20}...)
502 b = append(b, tk.monthsWide[t.Month()]...)
503 b = append(b, []byte{0x20}...)
504
505 if t.Year() > 0 {
506 b = strconv.AppendInt(b, int64(t.Year()), 10)
507 } else {
508 b = strconv.AppendInt(b, int64(-t.Year()), 10)
509 }
510
511 b = append(b, []byte{0x20}...)
512 b = append(b, tk.daysWide[t.Weekday()]...)
513
514 return string(b)
515 }
516
517
518 func (tk *tk_TM) FmtTimeShort(t time.Time) string {
519
520 b := make([]byte, 0, 32)
521
522 if t.Hour() < 10 {
523 b = append(b, '0')
524 }
525
526 b = strconv.AppendInt(b, int64(t.Hour()), 10)
527 b = append(b, tk.timeSeparator...)
528
529 if t.Minute() < 10 {
530 b = append(b, '0')
531 }
532
533 b = strconv.AppendInt(b, int64(t.Minute()), 10)
534
535 return string(b)
536 }
537
538
539 func (tk *tk_TM) FmtTimeMedium(t time.Time) string {
540
541 b := make([]byte, 0, 32)
542
543 if t.Hour() < 10 {
544 b = append(b, '0')
545 }
546
547 b = strconv.AppendInt(b, int64(t.Hour()), 10)
548 b = append(b, tk.timeSeparator...)
549
550 if t.Minute() < 10 {
551 b = append(b, '0')
552 }
553
554 b = strconv.AppendInt(b, int64(t.Minute()), 10)
555 b = append(b, tk.timeSeparator...)
556
557 if t.Second() < 10 {
558 b = append(b, '0')
559 }
560
561 b = strconv.AppendInt(b, int64(t.Second()), 10)
562
563 return string(b)
564 }
565
566
567 func (tk *tk_TM) FmtTimeLong(t time.Time) string {
568
569 b := make([]byte, 0, 32)
570
571 if t.Hour() < 10 {
572 b = append(b, '0')
573 }
574
575 b = strconv.AppendInt(b, int64(t.Hour()), 10)
576 b = append(b, tk.timeSeparator...)
577
578 if t.Minute() < 10 {
579 b = append(b, '0')
580 }
581
582 b = strconv.AppendInt(b, int64(t.Minute()), 10)
583 b = append(b, tk.timeSeparator...)
584
585 if t.Second() < 10 {
586 b = append(b, '0')
587 }
588
589 b = strconv.AppendInt(b, int64(t.Second()), 10)
590 b = append(b, []byte{0x20}...)
591
592 tz, _ := t.Zone()
593 b = append(b, tz...)
594
595 return string(b)
596 }
597
598
599 func (tk *tk_TM) FmtTimeFull(t time.Time) string {
600
601 b := make([]byte, 0, 32)
602
603 if t.Hour() < 10 {
604 b = append(b, '0')
605 }
606
607 b = strconv.AppendInt(b, int64(t.Hour()), 10)
608 b = append(b, tk.timeSeparator...)
609
610 if t.Minute() < 10 {
611 b = append(b, '0')
612 }
613
614 b = strconv.AppendInt(b, int64(t.Minute()), 10)
615 b = append(b, tk.timeSeparator...)
616
617 if t.Second() < 10 {
618 b = append(b, '0')
619 }
620
621 b = strconv.AppendInt(b, int64(t.Second()), 10)
622 b = append(b, []byte{0x20}...)
623
624 tz, _ := t.Zone()
625
626 if btz, ok := tk.timezones[tz]; ok {
627 b = append(b, btz...)
628 } else {
629 b = append(b, tz...)
630 }
631
632 return string(b)
633 }
634
View as plain text