X7ROOT File Manager
Current Path:
/opt/golang/1.17.2/src/time
opt
/
golang
/
1.17.2
/
src
/
time
/
📁
..
📄
embed.go
(325 B)
📄
example_test.go
(19.97 KB)
📄
export_android_test.go
(318 B)
📄
export_test.go
(3.75 KB)
📄
export_windows_test.go
(514 B)
📄
format.go
(45.91 KB)
📄
format_test.go
(28.93 KB)
📄
genzabbrs.go
(2.97 KB)
📄
internal_test.go
(1.91 KB)
📄
mono_test.go
(7.51 KB)
📄
sleep.go
(5.83 KB)
📄
sleep_test.go
(18.33 KB)
📄
sys_plan9.go
(1.01 KB)
📄
sys_unix.go
(1.16 KB)
📄
sys_windows.go
(996 B)
📁
testdata
📄
tick.go
(2.16 KB)
📄
tick_test.go
(3.54 KB)
📄
time.go
(46.46 KB)
📄
time_test.go
(45.1 KB)
📁
tzdata
📄
tzdata_test.go
(2.48 KB)
📄
zoneinfo.go
(17.2 KB)
📄
zoneinfo_abbrs_windows.go
(10.34 KB)
📄
zoneinfo_android.go
(2.05 KB)
📄
zoneinfo_android_test.go
(408 B)
📄
zoneinfo_ios.go
(1.01 KB)
📄
zoneinfo_js.go
(1.58 KB)
📄
zoneinfo_plan9.go
(2.71 KB)
📄
zoneinfo_read.go
(13.98 KB)
📄
zoneinfo_test.go
(9.81 KB)
📄
zoneinfo_unix.go
(1.84 KB)
📄
zoneinfo_unix_test.go
(2.46 KB)
📄
zoneinfo_windows.go
(6.68 KB)
📄
zoneinfo_windows_test.go
(1.9 KB)
Editing: zoneinfo_plan9.go
// Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Parse Plan 9 timezone(2) files. package time import ( "runtime" "syscall" ) var zoneSources = []string{ runtime.GOROOT() + "/lib/time/zoneinfo.zip", } func isSpace(r rune) bool { return r == ' ' || r == '\t' || r == '\n' } // Copied from strings to avoid a dependency. func fields(s string) []string { // First count the fields. n := 0 inField := false for _, rune := range s { wasInField := inField inField = !isSpace(rune) if inField && !wasInField { n++ } } // Now create them. a := make([]string, n) na := 0 fieldStart := -1 // Set to -1 when looking for start of field. for i, rune := range s { if isSpace(rune) { if fieldStart >= 0 { a[na] = s[fieldStart:i] na++ fieldStart = -1 } } else if fieldStart == -1 { fieldStart = i } } if fieldStart >= 0 { // Last field might end at EOF. a[na] = s[fieldStart:] } return a } func loadZoneDataPlan9(s string) (l *Location, err error) { f := fields(s) if len(f) < 4 { if len(f) == 2 && f[0] == "GMT" { return UTC, nil } return nil, badData } var zones [2]zone // standard timezone offset o, err := atoi(f[1]) if err != nil { return nil, badData } zones[0] = zone{name: f[0], offset: o, isDST: false} // alternate timezone offset o, err = atoi(f[3]) if err != nil { return nil, badData } zones[1] = zone{name: f[2], offset: o, isDST: true} // transition time pairs var tx []zoneTrans f = f[4:] for i := 0; i < len(f); i++ { zi := 0 if i%2 == 0 { zi = 1 } t, err := atoi(f[i]) if err != nil { return nil, badData } t -= zones[0].offset tx = append(tx, zoneTrans{when: int64(t), index: uint8(zi)}) } // Committed to succeed. l = &Location{zone: zones[:], tx: tx} // Fill in the cache with information about right now, // since that will be the most common lookup. sec, _, _ := now() for i := range tx { if tx[i].when <= sec && (i+1 == len(tx) || sec < tx[i+1].when) { l.cacheStart = tx[i].when l.cacheEnd = omega if i+1 < len(tx) { l.cacheEnd = tx[i+1].when } l.cacheZone = &l.zone[tx[i].index] } } return l, nil } func loadZoneFilePlan9(name string) (*Location, error) { b, err := readFile(name) if err != nil { return nil, err } return loadZoneDataPlan9(string(b)) } func initLocal() { t, ok := syscall.Getenv("timezone") if ok { if z, err := loadZoneDataPlan9(t); err == nil { localLoc = *z return } } else { if z, err := loadZoneFilePlan9("/adm/timezone/local"); err == nil { localLoc = *z localLoc.name = "Local" return } } // Fall back to UTC. localLoc.name = "UTC" }
Upload File
Create Folder