...

Source file src/github.com/go-playground/locales/agq_CM/agq_CM.go

Documentation: github.com/go-playground/locales/agq_CM

     1  package agq_CM
     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 agq_CM 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  	monthsAbbreviated  []string
    26  	monthsNarrow       []string
    27  	monthsWide         []string
    28  	daysAbbreviated    []string
    29  	daysNarrow         []string
    30  	daysShort          []string
    31  	daysWide           []string
    32  	periodsAbbreviated []string
    33  	periodsNarrow      []string
    34  	periodsShort       []string
    35  	periodsWide        []string
    36  	erasAbbreviated    []string
    37  	erasNarrow         []string
    38  	erasWide           []string
    39  	timezones          map[string]string
    40  }
    41  
    42  // New returns a new instance of translator for the 'agq_CM' locale
    43  func New() locales.Translator {
    44  	return &agq_CM{
    45  		locale:             "agq_CM",
    46  		pluralsCardinal:    nil,
    47  		pluralsOrdinal:     nil,
    48  		pluralsRange:       nil,
    49  		decimal:            ",",
    50  		group:              " ",
    51  		timeSeparator:      ":",
    52  		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"},
    53  		monthsAbbreviated:  []string{"", "nùm", "kɨz", "tɨd", "taa", "see", "nzu", "dum", "fɔe", "dzu", "lɔm", "kaa", "fwo"},
    54  		monthsNarrow:       []string{"", "n", "k", "t", "t", "s", "z", "k", "f", "d", "l", "c", "f"},
    55  		monthsWide:         []string{"", "ndzɔ̀ŋɔ̀nùm", "ndzɔ̀ŋɔ̀kƗ̀zùʔ", "ndzɔ̀ŋɔ̀tƗ̀dʉ̀ghà", "ndzɔ̀ŋɔ̀tǎafʉ̄ghā", "ndzɔ̀ŋèsèe", "ndzɔ̀ŋɔ̀nzùghò", "ndzɔ̀ŋɔ̀dùmlo", "ndzɔ̀ŋɔ̀kwîfɔ̀e", "ndzɔ̀ŋɔ̀tƗ̀fʉ̀ghàdzughù", "ndzɔ̀ŋɔ̀ghǔuwelɔ̀m", "ndzɔ̀ŋɔ̀chwaʔàkaa wo", "ndzɔ̀ŋèfwòo"},
    56  		daysAbbreviated:    []string{"nts", "kpa", "ghɔ", "tɔm", "ume", "ghɨ", "dzk"},
    57  		daysNarrow:         []string{"n", "k", "g", "t", "u", "g", "d"},
    58  		daysWide:           []string{"tsuʔntsɨ", "tsuʔukpà", "tsuʔughɔe", "tsuʔutɔ̀mlò", "tsuʔumè", "tsuʔughɨ̂m", "tsuʔndzɨkɔʔɔ"},
    59  		periodsAbbreviated: []string{"a.g", "a.k"},
    60  		periodsWide:        []string{"a.g", "a.k"},
    61  		erasAbbreviated:    []string{"SK", "BK"},
    62  		erasNarrow:         []string{"", ""},
    63  		erasWide:           []string{"Sěe Kɨ̀lesto", "Bǎa Kɨ̀lesto"},
    64  		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", "∅∅∅": "∅∅∅"},
    65  	}
    66  }
    67  
    68  // Locale returns the current translators string locale
    69  func (agq *agq_CM) Locale() string {
    70  	return agq.locale
    71  }
    72  
    73  // PluralsCardinal returns the list of cardinal plural rules associated with 'agq_CM'
    74  func (agq *agq_CM) PluralsCardinal() []locales.PluralRule {
    75  	return agq.pluralsCardinal
    76  }
    77  
    78  // PluralsOrdinal returns the list of ordinal plural rules associated with 'agq_CM'
    79  func (agq *agq_CM) PluralsOrdinal() []locales.PluralRule {
    80  	return agq.pluralsOrdinal
    81  }
    82  
    83  // PluralsRange returns the list of range plural rules associated with 'agq_CM'
    84  func (agq *agq_CM) PluralsRange() []locales.PluralRule {
    85  	return agq.pluralsRange
    86  }
    87  
    88  // CardinalPluralRule returns the cardinal PluralRule given 'num' and digits/precision of 'v' for 'agq_CM'
    89  func (agq *agq_CM) CardinalPluralRule(num float64, v uint64) locales.PluralRule {
    90  	return locales.PluralRuleUnknown
    91  }
    92  
    93  // OrdinalPluralRule returns the ordinal PluralRule given 'num' and digits/precision of 'v' for 'agq_CM'
    94  func (agq *agq_CM) OrdinalPluralRule(num float64, v uint64) locales.PluralRule {
    95  	return locales.PluralRuleUnknown
    96  }
    97  
    98  // RangePluralRule returns the ordinal PluralRule given 'num1', 'num2' and digits/precision of 'v1' and 'v2' for 'agq_CM'
    99  func (agq *agq_CM) RangePluralRule(num1 float64, v1 uint64, num2 float64, v2 uint64) locales.PluralRule {
   100  	return locales.PluralRuleUnknown
   101  }
   102  
   103  // MonthAbbreviated returns the locales abbreviated month given the 'month' provided
   104  func (agq *agq_CM) MonthAbbreviated(month time.Month) string {
   105  	return agq.monthsAbbreviated[month]
   106  }
   107  
   108  // MonthsAbbreviated returns the locales abbreviated months
   109  func (agq *agq_CM) MonthsAbbreviated() []string {
   110  	return agq.monthsAbbreviated[1:]
   111  }
   112  
   113  // MonthNarrow returns the locales narrow month given the 'month' provided
   114  func (agq *agq_CM) MonthNarrow(month time.Month) string {
   115  	return agq.monthsNarrow[month]
   116  }
   117  
   118  // MonthsNarrow returns the locales narrow months
   119  func (agq *agq_CM) MonthsNarrow() []string {
   120  	return agq.monthsNarrow[1:]
   121  }
   122  
   123  // MonthWide returns the locales wide month given the 'month' provided
   124  func (agq *agq_CM) MonthWide(month time.Month) string {
   125  	return agq.monthsWide[month]
   126  }
   127  
   128  // MonthsWide returns the locales wide months
   129  func (agq *agq_CM) MonthsWide() []string {
   130  	return agq.monthsWide[1:]
   131  }
   132  
   133  // WeekdayAbbreviated returns the locales abbreviated weekday given the 'weekday' provided
   134  func (agq *agq_CM) WeekdayAbbreviated(weekday time.Weekday) string {
   135  	return agq.daysAbbreviated[weekday]
   136  }
   137  
   138  // WeekdaysAbbreviated returns the locales abbreviated weekdays
   139  func (agq *agq_CM) WeekdaysAbbreviated() []string {
   140  	return agq.daysAbbreviated
   141  }
   142  
   143  // WeekdayNarrow returns the locales narrow weekday given the 'weekday' provided
   144  func (agq *agq_CM) WeekdayNarrow(weekday time.Weekday) string {
   145  	return agq.daysNarrow[weekday]
   146  }
   147  
   148  // WeekdaysNarrow returns the locales narrow weekdays
   149  func (agq *agq_CM) WeekdaysNarrow() []string {
   150  	return agq.daysNarrow
   151  }
   152  
   153  // WeekdayShort returns the locales short weekday given the 'weekday' provided
   154  func (agq *agq_CM) WeekdayShort(weekday time.Weekday) string {
   155  	return agq.daysShort[weekday]
   156  }
   157  
   158  // WeekdaysShort returns the locales short weekdays
   159  func (agq *agq_CM) WeekdaysShort() []string {
   160  	return agq.daysShort
   161  }
   162  
   163  // WeekdayWide returns the locales wide weekday given the 'weekday' provided
   164  func (agq *agq_CM) WeekdayWide(weekday time.Weekday) string {
   165  	return agq.daysWide[weekday]
   166  }
   167  
   168  // WeekdaysWide returns the locales wide weekdays
   169  func (agq *agq_CM) WeekdaysWide() []string {
   170  	return agq.daysWide
   171  }
   172  
   173  // Decimal returns the decimal point of number
   174  func (agq *agq_CM) Decimal() string {
   175  	return agq.decimal
   176  }
   177  
   178  // Group returns the group of number
   179  func (agq *agq_CM) Group() string {
   180  	return agq.group
   181  }
   182  
   183  // Group returns the minus sign of number
   184  func (agq *agq_CM) Minus() string {
   185  	return agq.minus
   186  }
   187  
   188  // FmtNumber returns 'num' with digits/precision of 'v' for 'agq_CM' and handles both Whole and Real numbers based on 'v'
   189  func (agq *agq_CM) FmtNumber(num float64, v uint64) string {
   190  
   191  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   192  	l := len(s) + 1 + 2*len(s[:len(s)-int(v)-1])/3
   193  	count := 0
   194  	inWhole := v == 0
   195  	b := make([]byte, 0, l)
   196  
   197  	for i := len(s) - 1; i >= 0; i-- {
   198  
   199  		if s[i] == '.' {
   200  			b = append(b, agq.decimal[0])
   201  			inWhole = true
   202  			continue
   203  		}
   204  
   205  		if inWhole {
   206  			if count == 3 {
   207  				for j := len(agq.group) - 1; j >= 0; j-- {
   208  					b = append(b, agq.group[j])
   209  				}
   210  				count = 1
   211  			} else {
   212  				count++
   213  			}
   214  		}
   215  
   216  		b = append(b, s[i])
   217  	}
   218  
   219  	if num < 0 {
   220  		b = append(b, agq.minus[0])
   221  	}
   222  
   223  	// reverse
   224  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   225  		b[i], b[j] = b[j], b[i]
   226  	}
   227  
   228  	return string(b)
   229  }
   230  
   231  // FmtPercent returns 'num' with digits/precision of 'v' for 'agq_CM' and handles both Whole and Real numbers based on 'v'
   232  // NOTE: 'num' passed into FmtPercent is assumed to be in percent already
   233  func (agq *agq_CM) FmtPercent(num float64, v uint64) string {
   234  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   235  	l := len(s) + 1
   236  	b := make([]byte, 0, l)
   237  
   238  	for i := len(s) - 1; i >= 0; i-- {
   239  
   240  		if s[i] == '.' {
   241  			b = append(b, agq.decimal[0])
   242  			continue
   243  		}
   244  
   245  		b = append(b, s[i])
   246  	}
   247  
   248  	if num < 0 {
   249  		b = append(b, agq.minus[0])
   250  	}
   251  
   252  	// reverse
   253  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   254  		b[i], b[j] = b[j], b[i]
   255  	}
   256  
   257  	b = append(b, agq.percent...)
   258  
   259  	return string(b)
   260  }
   261  
   262  // FmtCurrency returns the currency representation of 'num' with digits/precision of 'v' for 'agq_CM'
   263  func (agq *agq_CM) FmtCurrency(num float64, v uint64, currency currency.Type) string {
   264  
   265  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   266  	symbol := agq.currencies[currency]
   267  	l := len(s) + len(symbol) + 1 + 2*len(s[:len(s)-int(v)-1])/3
   268  	count := 0
   269  	inWhole := v == 0
   270  	b := make([]byte, 0, l)
   271  
   272  	for i := len(s) - 1; i >= 0; i-- {
   273  
   274  		if s[i] == '.' {
   275  			b = append(b, agq.decimal[0])
   276  			inWhole = true
   277  			continue
   278  		}
   279  
   280  		if inWhole {
   281  			if count == 3 {
   282  				for j := len(agq.group) - 1; j >= 0; j-- {
   283  					b = append(b, agq.group[j])
   284  				}
   285  				count = 1
   286  			} else {
   287  				count++
   288  			}
   289  		}
   290  
   291  		b = append(b, s[i])
   292  	}
   293  
   294  	if num < 0 {
   295  		b = append(b, agq.minus[0])
   296  	}
   297  
   298  	// reverse
   299  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   300  		b[i], b[j] = b[j], b[i]
   301  	}
   302  
   303  	if int(v) < 2 {
   304  
   305  		if v == 0 {
   306  			b = append(b, agq.decimal...)
   307  		}
   308  
   309  		for i := 0; i < 2-int(v); i++ {
   310  			b = append(b, '0')
   311  		}
   312  	}
   313  
   314  	b = append(b, symbol...)
   315  
   316  	return string(b)
   317  }
   318  
   319  // FmtAccounting returns the currency representation of 'num' with digits/precision of 'v' for 'agq_CM'
   320  // in accounting notation.
   321  func (agq *agq_CM) FmtAccounting(num float64, v uint64, currency currency.Type) string {
   322  
   323  	s := strconv.FormatFloat(math.Abs(num), 'f', int(v), 64)
   324  	symbol := agq.currencies[currency]
   325  	l := len(s) + len(symbol) + 1 + 2*len(s[:len(s)-int(v)-1])/3
   326  	count := 0
   327  	inWhole := v == 0
   328  	b := make([]byte, 0, l)
   329  
   330  	for i := len(s) - 1; i >= 0; i-- {
   331  
   332  		if s[i] == '.' {
   333  			b = append(b, agq.decimal[0])
   334  			inWhole = true
   335  			continue
   336  		}
   337  
   338  		if inWhole {
   339  			if count == 3 {
   340  				for j := len(agq.group) - 1; j >= 0; j-- {
   341  					b = append(b, agq.group[j])
   342  				}
   343  				count = 1
   344  			} else {
   345  				count++
   346  			}
   347  		}
   348  
   349  		b = append(b, s[i])
   350  	}
   351  
   352  	if num < 0 {
   353  
   354  		b = append(b, agq.minus[0])
   355  
   356  	}
   357  
   358  	// reverse
   359  	for i, j := 0, len(b)-1; i < j; i, j = i+1, j-1 {
   360  		b[i], b[j] = b[j], b[i]
   361  	}
   362  
   363  	if int(v) < 2 {
   364  
   365  		if v == 0 {
   366  			b = append(b, agq.decimal...)
   367  		}
   368  
   369  		for i := 0; i < 2-int(v); i++ {
   370  			b = append(b, '0')
   371  		}
   372  	}
   373  
   374  	if num < 0 {
   375  		b = append(b, symbol...)
   376  	} else {
   377  
   378  		b = append(b, symbol...)
   379  	}
   380  
   381  	return string(b)
   382  }
   383  
   384  // FmtDateShort returns the short date representation of 't' for 'agq_CM'
   385  func (agq *agq_CM) FmtDateShort(t time.Time) string {
   386  
   387  	b := make([]byte, 0, 32)
   388  
   389  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   390  	b = append(b, []byte{0x2f}...)
   391  	b = strconv.AppendInt(b, int64(t.Month()), 10)
   392  	b = append(b, []byte{0x2f}...)
   393  
   394  	if t.Year() > 0 {
   395  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   396  	} else {
   397  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   398  	}
   399  
   400  	return string(b)
   401  }
   402  
   403  // FmtDateMedium returns the medium date representation of 't' for 'agq_CM'
   404  func (agq *agq_CM) FmtDateMedium(t time.Time) string {
   405  
   406  	b := make([]byte, 0, 32)
   407  
   408  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   409  	b = append(b, []byte{0x20}...)
   410  	b = append(b, agq.monthsAbbreviated[t.Month()]...)
   411  	b = append(b, []byte{0x2c, 0x20}...)
   412  
   413  	if t.Year() > 0 {
   414  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   415  	} else {
   416  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   417  	}
   418  
   419  	return string(b)
   420  }
   421  
   422  // FmtDateLong returns the long date representation of 't' for 'agq_CM'
   423  func (agq *agq_CM) FmtDateLong(t time.Time) string {
   424  
   425  	b := make([]byte, 0, 32)
   426  
   427  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   428  	b = append(b, []byte{0x20}...)
   429  	b = append(b, agq.monthsWide[t.Month()]...)
   430  	b = append(b, []byte{0x20}...)
   431  
   432  	if t.Year() > 0 {
   433  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   434  	} else {
   435  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   436  	}
   437  
   438  	return string(b)
   439  }
   440  
   441  // FmtDateFull returns the full date representation of 't' for 'agq_CM'
   442  func (agq *agq_CM) FmtDateFull(t time.Time) string {
   443  
   444  	b := make([]byte, 0, 32)
   445  
   446  	b = append(b, agq.daysWide[t.Weekday()]...)
   447  	b = append(b, []byte{0x20}...)
   448  	b = strconv.AppendInt(b, int64(t.Day()), 10)
   449  	b = append(b, []byte{0x20}...)
   450  	b = append(b, agq.monthsWide[t.Month()]...)
   451  	b = append(b, []byte{0x20}...)
   452  
   453  	if t.Year() > 0 {
   454  		b = strconv.AppendInt(b, int64(t.Year()), 10)
   455  	} else {
   456  		b = strconv.AppendInt(b, int64(-t.Year()), 10)
   457  	}
   458  
   459  	return string(b)
   460  }
   461  
   462  // FmtTimeShort returns the short time representation of 't' for 'agq_CM'
   463  func (agq *agq_CM) FmtTimeShort(t time.Time) string {
   464  
   465  	b := make([]byte, 0, 32)
   466  
   467  	if t.Hour() < 10 {
   468  		b = append(b, '0')
   469  	}
   470  
   471  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   472  	b = append(b, agq.timeSeparator...)
   473  
   474  	if t.Minute() < 10 {
   475  		b = append(b, '0')
   476  	}
   477  
   478  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   479  
   480  	return string(b)
   481  }
   482  
   483  // FmtTimeMedium returns the medium time representation of 't' for 'agq_CM'
   484  func (agq *agq_CM) FmtTimeMedium(t time.Time) string {
   485  
   486  	b := make([]byte, 0, 32)
   487  
   488  	if t.Hour() < 10 {
   489  		b = append(b, '0')
   490  	}
   491  
   492  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   493  	b = append(b, agq.timeSeparator...)
   494  
   495  	if t.Minute() < 10 {
   496  		b = append(b, '0')
   497  	}
   498  
   499  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   500  	b = append(b, agq.timeSeparator...)
   501  
   502  	if t.Second() < 10 {
   503  		b = append(b, '0')
   504  	}
   505  
   506  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   507  
   508  	return string(b)
   509  }
   510  
   511  // FmtTimeLong returns the long time representation of 't' for 'agq_CM'
   512  func (agq *agq_CM) FmtTimeLong(t time.Time) string {
   513  
   514  	b := make([]byte, 0, 32)
   515  
   516  	if t.Hour() < 10 {
   517  		b = append(b, '0')
   518  	}
   519  
   520  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   521  	b = append(b, agq.timeSeparator...)
   522  
   523  	if t.Minute() < 10 {
   524  		b = append(b, '0')
   525  	}
   526  
   527  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   528  	b = append(b, agq.timeSeparator...)
   529  
   530  	if t.Second() < 10 {
   531  		b = append(b, '0')
   532  	}
   533  
   534  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   535  	b = append(b, []byte{0x20}...)
   536  
   537  	tz, _ := t.Zone()
   538  	b = append(b, tz...)
   539  
   540  	return string(b)
   541  }
   542  
   543  // FmtTimeFull returns the full time representation of 't' for 'agq_CM'
   544  func (agq *agq_CM) FmtTimeFull(t time.Time) string {
   545  
   546  	b := make([]byte, 0, 32)
   547  
   548  	if t.Hour() < 10 {
   549  		b = append(b, '0')
   550  	}
   551  
   552  	b = strconv.AppendInt(b, int64(t.Hour()), 10)
   553  	b = append(b, agq.timeSeparator...)
   554  
   555  	if t.Minute() < 10 {
   556  		b = append(b, '0')
   557  	}
   558  
   559  	b = strconv.AppendInt(b, int64(t.Minute()), 10)
   560  	b = append(b, agq.timeSeparator...)
   561  
   562  	if t.Second() < 10 {
   563  		b = append(b, '0')
   564  	}
   565  
   566  	b = strconv.AppendInt(b, int64(t.Second()), 10)
   567  	b = append(b, []byte{0x20}...)
   568  
   569  	tz, _ := t.Zone()
   570  
   571  	if btz, ok := agq.timezones[tz]; ok {
   572  		b = append(b, btz...)
   573  	} else {
   574  		b = append(b, tz...)
   575  	}
   576  
   577  	return string(b)
   578  }
   579  

View as plain text