Source file src/time/export_test.go

Documentation: time

     1  // Copyright 2013 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package time
     6  
     7  import (
     8  	"sync"
     9  )
    10  
    11  func ResetLocalOnceForTest() {
    12  	localOnce = sync.Once{}
    13  	localLoc = Location{}
    14  }
    15  
    16  func ForceUSPacificForTesting() {
    17  	ResetLocalOnceForTest()
    18  	localOnce.Do(initTestingZone)
    19  }
    20  
    21  func ZoneinfoForTesting() *string {
    22  	return zoneinfo
    23  }
    24  
    25  func ResetZoneinfoForTesting() {
    26  	zoneinfo = nil
    27  	zoneinfoOnce = sync.Once{}
    28  }
    29  
    30  var (
    31  	ForceZipFileForTesting = forceZipFileForTesting
    32  	ParseTimeZone          = parseTimeZone
    33  	SetMono                = (*Time).setMono
    34  	GetMono                = (*Time).mono
    35  	ErrLocation            = errLocation
    36  	ReadFile               = readFile
    37  	LoadTzinfo             = loadTzinfo
    38  	NextStdChunk           = nextStdChunk
    39  )
    40  
    41  // StdChunkNames maps from nextStdChunk results to the matched strings.
    42  var StdChunkNames = map[int]string{
    43  	0:                               "",
    44  	stdLongMonth:                    "January",
    45  	stdMonth:                        "Jan",
    46  	stdNumMonth:                     "1",
    47  	stdZeroMonth:                    "01",
    48  	stdLongWeekDay:                  "Monday",
    49  	stdWeekDay:                      "Mon",
    50  	stdDay:                          "2",
    51  	stdUnderDay:                     "_2",
    52  	stdZeroDay:                      "02",
    53  	stdUnderYearDay:                 "__2",
    54  	stdZeroYearDay:                  "002",
    55  	stdHour:                         "15",
    56  	stdHour12:                       "3",
    57  	stdZeroHour12:                   "03",
    58  	stdMinute:                       "4",
    59  	stdZeroMinute:                   "04",
    60  	stdSecond:                       "5",
    61  	stdZeroSecond:                   "05",
    62  	stdLongYear:                     "2006",
    63  	stdYear:                         "06",
    64  	stdPM:                           "PM",
    65  	stdpm:                           "pm",
    66  	stdTZ:                           "MST",
    67  	stdISO8601TZ:                    "Z0700",
    68  	stdISO8601SecondsTZ:             "Z070000",
    69  	stdISO8601ShortTZ:               "Z07",
    70  	stdISO8601ColonTZ:               "Z07:00",
    71  	stdISO8601ColonSecondsTZ:        "Z07:00:00",
    72  	stdNumTZ:                        "-0700",
    73  	stdNumSecondsTz:                 "-070000",
    74  	stdNumShortTZ:                   "-07",
    75  	stdNumColonTZ:                   "-07:00",
    76  	stdNumColonSecondsTZ:            "-07:00:00",
    77  	stdFracSecond0 | 1<<stdArgShift: ".0",
    78  	stdFracSecond0 | 2<<stdArgShift: ".00",
    79  	stdFracSecond0 | 3<<stdArgShift: ".000",
    80  	stdFracSecond0 | 4<<stdArgShift: ".0000",
    81  	stdFracSecond0 | 5<<stdArgShift: ".00000",
    82  	stdFracSecond0 | 6<<stdArgShift: ".000000",
    83  	stdFracSecond0 | 7<<stdArgShift: ".0000000",
    84  	stdFracSecond0 | 8<<stdArgShift: ".00000000",
    85  	stdFracSecond0 | 9<<stdArgShift: ".000000000",
    86  	stdFracSecond9 | 1<<stdArgShift: ".9",
    87  	stdFracSecond9 | 2<<stdArgShift: ".99",
    88  	stdFracSecond9 | 3<<stdArgShift: ".999",
    89  	stdFracSecond9 | 4<<stdArgShift: ".9999",
    90  	stdFracSecond9 | 5<<stdArgShift: ".99999",
    91  	stdFracSecond9 | 6<<stdArgShift: ".999999",
    92  	stdFracSecond9 | 7<<stdArgShift: ".9999999",
    93  	stdFracSecond9 | 8<<stdArgShift: ".99999999",
    94  	stdFracSecond9 | 9<<stdArgShift: ".999999999",
    95  }
    96  

View as plain text