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