1 package ne_NP
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 ne_NP 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
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
45 func New() locales.Translator {
46 return &ne_NP{
47 locale: "ne_NP",
48 pluralsCardinal: []locales.PluralRule{2, 6},
49 pluralsOrdinal: []locales.PluralRule{2, 6},
50 pluralsRange: []locales.PluralRule{2, 6},
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", "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"},
59 currencyPositivePrefix: " ",
60 currencyNegativePrefix: " ",
61 monthsAbbreviated: []string{"", "जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"},
62 monthsNarrow: []string{"", "जन", "फेब", "मार्च", "अप्र", "मे", "जुन", "जुल", "अग", "सेप", "अक्टो", "नोभे", "डिसे"},
63 monthsWide: []string{"", "जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"},
64 daysAbbreviated: []string{"आइत", "सोम", "मङ्गल", "बुध", "बिहि", "शुक्र", "शनि"},
65 daysNarrow: []string{"आ", "सो", "म", "बु", "बि", "शु", "श"},
66 daysShort: []string{"आइत", "सोम", "मङ्गल", "बुध", "बिहि", "शुक्र", "शनि"},
67 daysWide: []string{"आइतबार", "सोमबार", "मङ्गलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार"},
68 periodsAbbreviated: []string{"पूर्वाह्न", "अपराह्न"},
69 periodsNarrow: []string{"पूर्वाह्न", "अपराह्न"},
70 periodsWide: []string{"पूर्वाह्न", "अपराह्न"},
71 erasAbbreviated: []string{"ईसा पूर्व", "सन्"},
72 erasNarrow: []string{"", ""},
73 erasWide: []string{"ईसा पूर्व", "सन्"},
74 timezones: map[string]string{"ACDT": "केन्द्रीय अस्ट्रेलिया दिवा समय", "ACST": "केन्द्रीय अस्ट्रेलिया मानक समय", "ACWDT": "केन्द्रीय पश्चिमी अस्ट्रेलिया दिवा समय", "ACWST": "केन्द्रीय पश्चिमी अस्ट्रेलिया मानक समय", "ADT": "एट्लान्टिक दिवा समय", "AEDT": "पूर्वी अस्ट्रेलिया दिवा समय", "AEST": "पूर्वी अस्ट्रेलिया मानक समय", "AKDT": "अलस्काको दिवा समय", "AKST": "अलस्काको मानक समय", "ARST": "अर्जेनटिनी ग्रीष्मकालीन समय", "ART": "अर्जेनटिनी मानक समय", "AST": "एट्लान्टिक मानक समय", "AWDT": "पश्चिमी अस्ट्रेलिया दिवा समय", "AWST": "पश्चिमी अस्ट्रेलिया मानक समय", "BOT": "बोलिभिया समय", "BT": "भुटानी समय", "CAT": "केन्द्रीय अफ्रिकी समय", "CDT": "केन्द्रीय दिवा समय", "CHADT": "चाथाम दिवा समय", "CHAST": "चाथाम मानक समय", "CLST": "चिली ग्रीष्मकालीन समय", "CLT": "चिली मानक समय", "COST": "कोलम्बियाली ग्रीष्मकालीन समय", "COT": "कोलम्बियाली मानक समय", "CST": "केन्द्रीय मानक समय", "ChST": "चामोर्रो मानक समय", "EAT": "पूर्वी अफ्रिकी समय", "ECT": "ईक्वोडोर समय", "EDT": "पूर्वी दिवा समय", "EST": "पूर्वी मानक समय", "GFT": "फ्रेन्च ग्वाना समय", "GMT": "ग्रीनविच मिन समय", "GST": "खाडी मानक समय", "GYT": "गुयाना समय", "HADT": "हवाई-एलुटियन दिवा समय", "HAST": "हवाई-एलुटियन मानक समय", "HAT": "न्यूफाउनल्यान्डको दिवा समय", "HECU": "क्यूबाको दिवा समय", "HEEG": "पूर्वी ग्रीनल्यान्डको ग्रीष्मकालीन समय", "HENOMX": "उत्तर पश्चिम मेक्सिकोको दिवा समय", "HEOG": "पश्चिमी ग्रीनल्यान्डको ग्रीष्मकालीन समय", "HEPM": "सेन्ट पियर्रे र मिक्युलोनको दिवा समय", "HEPMX": "मेक्सिकन प्यासिफिक दिवा समय", "HKST": "हङकङ ग्रीष्मकालीन समय", "HKT": "हङकङ मानक समय", "HNCU": "क्यूबाको मानक समय", "HNEG": "पूर्वी ग्रीनल्यान्डको मानक समय", "HNNOMX": "उत्तर पश्चिम मेक्सिकोको मानक समय", "HNOG": "पश्चिमी ग्रीनल्यान्डको मानक समय", "HNPM": "सेन्ट पियर्रे र मिक्युलोनको मानक समय", "HNPMX": "मेक्सिकन प्यासिफिक मानक समय", "HNT": "न्यूफाउनडल्यान्डको मानक समय", "IST": "भारतीय मानक समय", "JDT": "जापान दिवा समय", "JST": "जापान मानक समय", "LHDT": "लर्ड हावे दिवा समय", "LHST": "लर्ड हावे मानक समय", "MDT": "हिमाली दिवा समय", "MESZ": "केन्द्रीय युरोपेली ग्रीष्मकालीन समय", "MEZ": "केन्द्रीय युरोपेली मानक समय", "MST": "हिमाली मानक समय", "MYT": "मलेसिया समय", "NZDT": "न्यूजिल्यान्ड दिवा समय", "NZST": "न्यूजिल्यान्ड मानक समय", "OESZ": "पूर्वी युरोपेली ग्रीष्मकालीन समय", "OEZ": "पूर्वी युरोपेली मानक समय", "PDT": "प्यासिफिक दिवा समय", "PST": "प्यासिफिक मानक समय", "SAST": "दक्षिण अफ्रिकी समय", "SGT": "सिंगापुर मानक समय", "SRT": "सुरिनामा समय", "TMST": "तुर्कमेनिस्तान ग्रीष्मकालीन मानक समय", "TMT": "तुर्कमेनिस्तान मानक समय", "UYST": "उरुग्वे ग्रीष्मकालीन समय", "UYT": "उरूग्वे मानक समय", "VET": "भेनेज्युएला समय", "WARST": "पश्चिमी अर्जेनटिनी ग्रीष्मकालीन समय", "WART": "पश्चिमी अर्जेनटिनी मानक समय", "WAST": "पश्चिम अफ्रिकी ग्रीष्मकालीन समय", "WAT": "पश्चिम अफ्रिकी मानक समय", "WESZ": "युरोपेली ग्रीष्मकालीन समय", "WEZ": "पश्चिमी युरोपेली मानक समय", "WIB": "पश्चिमी इन्डोनेशिया समय", "WIT": "पूर्वी इन्डोनेशिया समय", "WITA": "केन्द्रीय इन्डोनेशिया समय", "∅∅∅": "एजोरेस् ग्रीष्मकालीन समय"},
75 }
76 }
77
78
79 func (ne *ne_NP) Locale() string {
80 return ne.locale
81 }
82
83
84 func (ne *ne_NP) PluralsCardinal() []locales.PluralRule {
85 return ne.pluralsCardinal
86 }
87
88
89 func (ne *ne_NP) PluralsOrdinal() []locales.PluralRule {
90 return ne.pluralsOrdinal
91 }
92
93
94 func (ne *ne_NP) PluralsRange() []locales.PluralRule {
95 return ne.pluralsRange
96 }
97
98
99 func (ne *ne_NP) 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
111 func (ne *ne_NP) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
112
113 n := math.Abs(num)
114
115 if n >= 1 && n <= 4 {
116 return locales.PluralRuleOne
117 }
118
119 return locales.PluralRuleOther
120 }
121
122
123 func (ne *ne_NP) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
124
125 start := ne.CardinalPluralRule(num1, v1)
126 end := ne.CardinalPluralRule(num2, v2)
127
128 if start == locales.PluralRuleOne && end == locales.PluralRuleOther {
129 return locales.PluralRuleOther
130 } else if start == locales.PluralRuleOther && end == locales.PluralRuleOne {
131 return locales.PluralRuleOne
132 }
133
134 return locales.PluralRuleOther
135
136 }
137
138
139 func (ne *ne_NP) MonthAbbreviated(month time.Month) string {
140 return ne.monthsAbbreviated[month]
141 }
142
143
144 func (ne *ne_NP) MonthsAbbreviated() []string {
145 return ne.monthsAbbreviated[1:]
146 }
147
148
149 func (ne *ne_NP) MonthNarrow(month time.Month) string {
150 return ne.monthsNarrow[month]
151 }
152
153
154 func (ne *ne_NP) MonthsNarrow() []string {
155 return ne.monthsNarrow[1:]
156 }
157
158
159 func (ne *ne_NP) MonthWide(month time.Month) string {
160 return ne.monthsWide[month]
161 }
162
163
164 func (ne *ne_NP) MonthsWide() []string {
165 return ne.monthsWide[1:]
166 }
167
168
169 func (ne *ne_NP) WeekdayAbbreviated(weekday time.Weekday) string {
170 return ne.daysAbbreviated[weekday]
171 }
172
173
174 func (ne *ne_NP) WeekdaysAbbreviated() []string {
175 return ne.daysAbbreviated
176 }
177
178
179 func (ne *ne_NP) WeekdayNarrow(weekday time.Weekday) string {
180 return ne.daysNarrow[weekday]
181 }
182
183
184 func (ne *ne_NP) WeekdaysNarrow() []string {
185 return ne.daysNarrow
186 }
187
188
189 func (ne *ne_NP) WeekdayShort(weekday time.Weekday) string {
190 return ne.daysShort[weekday]
191 }
192
193
194 func (ne *ne_NP) WeekdaysShort() []string {
195 return ne.daysShort
196 }
197
198
199 func (ne *ne_NP) WeekdayWide(weekday time.Weekday) string {
200 return ne.daysWide[weekday]
201 }
202
203
204 func (ne *ne_NP) WeekdaysWide() []string {
205 return ne.daysWide
206 }
207
208
209 func (ne *ne_NP) Decimal() string {
210 return ne.decimal
211 }
212
213
214 func (ne *ne_NP) Group() string {
215 return ne.group
216 }
217
218
219 func (ne *ne_NP) Minus() string {
220 return ne.minus
221 }
222
223
224 func (ne *ne_NP) FmtNumber(num float64, v uint64) string {
225
226 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
227 l := len(s) + 2 + 1*len(s[:len(s)-int(v)-1])/3
228 count := 0
229 inWhole := v == 0
230 b := make([]byte, 0, l)
231
232 for i := len(s) - 1; i >= 0; i-- {
233
234 if s[i] == '.' {
235 b = append(b, ne.decimal[0])
236 inWhole = true
237 continue
238 }
239
240 if inWhole {
241 if count == 3 {
242 b = append(b, ne.group[0])
243 count = 1
244 } else {
245 count++
246 }
247 }
248
249 b = append(b, s[i])
250 }
251
252 if num < 0 {
253 b = append(b, ne.minus[0])
254 }
255
256
257 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
258 b[i], b[j] = b[j], b[i]
259 }
260
261 return string(b)
262 }
263
264
265
266 func (ne *ne_NP) FmtPercent(num float64, v uint64) string {
267 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
268 l := len(s) + 3
269 b := make([]byte, 0, l)
270
271 for i := len(s) - 1; i >= 0; i-- {
272
273 if s[i] == '.' {
274 b = append(b, ne.decimal[0])
275 continue
276 }
277
278 b = append(b, s[i])
279 }
280
281 if num < 0 {
282 b = append(b, ne.minus[0])
283 }
284
285
286 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
287 b[i], b[j] = b[j], b[i]
288 }
289
290 b = append(b, ne.percent...)
291
292 return string(b)
293 }
294
295
296 func (ne *ne_NP) FmtCurrency(num float64, v uint64, currency currency.Type) string {
297
298 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
299 symbol := ne.currencies[currency]
300 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
301 count := 0
302 inWhole := v == 0
303 b := make([]byte, 0, l)
304
305 for i := len(s) - 1; i >= 0; i-- {
306
307 if s[i] == '.' {
308 b = append(b, ne.decimal[0])
309 inWhole = true
310 continue
311 }
312
313 if inWhole {
314 if count == 3 {
315 b = append(b, ne.group[0])
316 count = 1
317 } else {
318 count++
319 }
320 }
321
322 b = append(b, s[i])
323 }
324
325 for j := len(symbol) - 1; j >= 0; j-- {
326 b = append(b, symbol[j])
327 }
328
329 for j := len(ne.currencyPositivePrefix) - 1; j >= 0; j-- {
330 b = append(b, ne.currencyPositivePrefix[j])
331 }
332
333 if num < 0 {
334 b = append(b, ne.minus[0])
335 }
336
337
338 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
339 b[i], b[j] = b[j], b[i]
340 }
341
342 if int(v) < 2 {
343
344 if v == 0 {
345 b = append(b, ne.decimal...)
346 }
347
348 for i := 0; i < 2-int(v); i++ {
349 b = append(b, '0')
350 }
351 }
352
353 return string(b)
354 }
355
356
357
358 func (ne *ne_NP) FmtAccounting(num float64, v uint64, currency currency.Type) string {
359
360 s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
361 symbol := ne.currencies[currency]
362 l := len(s) + len(symbol) + 4 + 1*len(s[:len(s)-int(v)-1])/3
363 count := 0
364 inWhole := v == 0
365 b := make([]byte, 0, l)
366
367 for i := len(s) - 1; i >= 0; i-- {
368
369 if s[i] == '.' {
370 b = append(b, ne.decimal[0])
371 inWhole = true
372 continue
373 }
374
375 if inWhole {
376 if count == 3 {
377 b = append(b, ne.group[0])
378 count = 1
379 } else {
380 count++
381 }
382 }
383
384 b = append(b, s[i])
385 }
386
387 if num < 0 {
388
389 for j := len(symbol) - 1; j >= 0; j-- {
390 b = append(b, symbol[j])
391 }
392
393 for j := len(ne.currencyNegativePrefix) - 1; j >= 0; j-- {
394 b = append(b, ne.currencyNegativePrefix[j])
395 }
396
397 b = append(b, ne.minus[0])
398
399 } else {
400
401 for j := len(symbol) - 1; j >= 0; j-- {
402 b = append(b, symbol[j])
403 }
404
405 for j := len(ne.currencyPositivePrefix) - 1; j >= 0; j-- {
406 b = append(b, ne.currencyPositivePrefix[j])
407 }
408
409 }
410
411
412 for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
413 b[i], b[j] = b[j], b[i]
414 }
415
416 if int(v) < 2 {
417
418 if v == 0 {
419 b = append(b, ne.decimal...)
420 }
421
422 for i := 0; i < 2-int(v); i++ {
423 b = append(b, '0')
424 }
425 }
426
427 return string(b)
428 }
429
430
431 func (ne *ne_NP) FmtDateShort(t time.Time) string {
432
433 b := make([]byte, 0, 32)
434
435 if t.Year() > 9 {
436 b = append(b, strconv.Itoa(t.Year())[2:]...)
437 } else {
438 b = append(b, strconv.Itoa(t.Year())[1:]...)
439 }
440
441 b = append(b, []byte{0x2f}...)
442 b = strconv.AppendInt(b, int64(t.Month()), 10)
443 b = append(b, []byte{0x2f}...)
444 b = strconv.AppendInt(b, int64(t.Day()), 10)
445
446 return string(b)
447 }
448
449
450 func (ne *ne_NP) FmtDateMedium(t time.Time) string {
451
452 b := make([]byte, 0, 32)
453
454 if t.Year() > 0 {
455 b = strconv.AppendInt(b, int64(t.Year()), 10)
456 } else {
457 b = strconv.AppendInt(b, int64(-t.Year()), 10)
458 }
459
460 b = append(b, []byte{0x20}...)
461 b = append(b, ne.monthsAbbreviated[t.Month()]...)
462 b = append(b, []byte{0x20}...)
463 b = strconv.AppendInt(b, int64(t.Day()), 10)
464
465 return string(b)
466 }
467
468
469 func (ne *ne_NP) FmtDateLong(t time.Time) string {
470
471 b := make([]byte, 0, 32)
472
473 if t.Year() > 0 {
474 b = strconv.AppendInt(b, int64(t.Year()), 10)
475 } else {
476 b = strconv.AppendInt(b, int64(-t.Year()), 10)
477 }
478
479 b = append(b, []byte{0x20}...)
480 b = append(b, ne.monthsWide[t.Month()]...)
481 b = append(b, []byte{0x20}...)
482 b = strconv.AppendInt(b, int64(t.Day()), 10)
483
484 return string(b)
485 }
486
487
488 func (ne *ne_NP) FmtDateFull(t time.Time) string {
489
490 b := make([]byte, 0, 32)
491
492 if t.Year() > 0 {
493 b = strconv.AppendInt(b, int64(t.Year()), 10)
494 } else {
495 b = strconv.AppendInt(b, int64(-t.Year()), 10)
496 }
497
498 b = append(b, []byte{0x20}...)
499 b = append(b, ne.monthsWide[t.Month()]...)
500 b = append(b, []byte{0x20}...)
501 b = strconv.AppendInt(b, int64(t.Day()), 10)
502 b = append(b, []byte{0x2c, 0x20}...)
503 b = append(b, ne.daysWide[t.Weekday()]...)
504
505 return string(b)
506 }
507
508
509 func (ne *ne_NP) FmtTimeShort(t time.Time) string {
510
511 b := make([]byte, 0, 32)
512
513 if t.Hour() < 10 {
514 b = append(b, '0')
515 }
516
517 b = strconv.AppendInt(b, int64(t.Hour()), 10)
518 b = append(b, ne.timeSeparator...)
519
520 if t.Minute() < 10 {
521 b = append(b, '0')
522 }
523
524 b = strconv.AppendInt(b, int64(t.Minute()), 10)
525
526 return string(b)
527 }
528
529
530 func (ne *ne_NP) FmtTimeMedium(t time.Time) string {
531
532 b := make([]byte, 0, 32)
533
534 if t.Hour() < 10 {
535 b = append(b, '0')
536 }
537
538 b = strconv.AppendInt(b, int64(t.Hour()), 10)
539 b = append(b, ne.timeSeparator...)
540
541 if t.Minute() < 10 {
542 b = append(b, '0')
543 }
544
545 b = strconv.AppendInt(b, int64(t.Minute()), 10)
546 b = append(b, ne.timeSeparator...)
547
548 if t.Second() < 10 {
549 b = append(b, '0')
550 }
551
552 b = strconv.AppendInt(b, int64(t.Second()), 10)
553
554 return string(b)
555 }
556
557
558 func (ne *ne_NP) FmtTimeLong(t time.Time) string {
559
560 b := make([]byte, 0, 32)
561
562 if t.Hour() < 10 {
563 b = append(b, '0')
564 }
565
566 b = strconv.AppendInt(b, int64(t.Hour()), 10)
567 b = append(b, ne.timeSeparator...)
568
569 if t.Minute() < 10 {
570 b = append(b, '0')
571 }
572
573 b = strconv.AppendInt(b, int64(t.Minute()), 10)
574 b = append(b, ne.timeSeparator...)
575
576 if t.Second() < 10 {
577 b = append(b, '0')
578 }
579
580 b = strconv.AppendInt(b, int64(t.Second()), 10)
581 b = append(b, []byte{0x20}...)
582
583 tz, _ := t.Zone()
584 b = append(b, tz...)
585
586 return string(b)
587 }
588
589
590 func (ne *ne_NP) FmtTimeFull(t time.Time) string {
591
592 b := make([]byte, 0, 32)
593
594 if t.Hour() < 10 {
595 b = append(b, '0')
596 }
597
598 b = strconv.AppendInt(b, int64(t.Hour()), 10)
599 b = append(b, ne.timeSeparator...)
600
601 if t.Minute() < 10 {
602 b = append(b, '0')
603 }
604
605 b = strconv.AppendInt(b, int64(t.Minute()), 10)
606 b = append(b, ne.timeSeparator...)
607
608 if t.Second() < 10 {
609 b = append(b, '0')
610 }
611
612 b = strconv.AppendInt(b, int64(t.Second()), 10)
613 b = append(b, []byte{0x20}...)
614
615 tz, _ := t.Zone()
616
617 if btz, ok := ne.timezones[tz]; ok {
618 b = append(b, btz...)
619 } else {
620 b = append(b, tz...)
621 }
622
623 return string(b)
624 }
625
View as plain text