Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(860)

Side by Side Diff: src/pkg/time/zoneinfo_read.go

Issue 6892048: runtime: synthetic time
Patch Set: diff -r f7c125983d99 https://code.google.com/p/go Created 11 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/time/zoneinfo_plan9.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Parse "zoneinfo" time zone file. 5 // Parse "zoneinfo" time zone file.
6 // This is a fairly standard file format used on OS X, Linux, BSD, Sun, and othe rs. 6 // This is a fairly standard file format used on OS X, Linux, BSD, Sun, and othe rs.
7 // See tzfile(5), http://en.wikipedia.org/wiki/Zoneinfo, 7 // See tzfile(5), http://en.wikipedia.org/wiki/Zoneinfo,
8 // and ftp://munnari.oz.au/pub/oldtz/ 8 // and ftp://munnari.oz.au/pub/oldtz/
9 9
10 package time 10 package time
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 if i < len(isutc) { 172 if i < len(isutc) {
173 tx[i].isutc = isutc[i] != 0 173 tx[i].isutc = isutc[i] != 0
174 } 174 }
175 } 175 }
176 176
177 // Commited to succeed. 177 // Commited to succeed.
178 l = &Location{zone: zone, tx: tx} 178 l = &Location{zone: zone, tx: tx}
179 179
180 // Fill in the cache with information about right now, 180 // Fill in the cache with information about right now,
181 // since that will be the most common lookup. 181 // since that will be the most common lookup.
182 » sec, _ := now() 182 » sec, _ := fakeNow()
183 for i := range tx { 183 for i := range tx {
184 if tx[i].when <= sec && (i+1 == len(tx) || sec < tx[i+1].when) { 184 if tx[i].when <= sec && (i+1 == len(tx) || sec < tx[i+1].when) {
185 l.cacheStart = tx[i].when 185 l.cacheStart = tx[i].when
186 l.cacheEnd = 1<<63 - 1 186 l.cacheEnd = 1<<63 - 1
187 if i+1 < len(tx) { 187 if i+1 < len(tx) {
188 l.cacheEnd = tx[i+1].when 188 l.cacheEnd = tx[i+1].when
189 } 189 }
190 l.cacheZone = &l.zone[tx[i].index] 190 l.cacheZone = &l.zone[tx[i].index]
191 } 191 }
192 } 192 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 buf = make([]byte, size) 332 buf = make([]byte, size)
333 if err := preadn(fd, buf, off+30+namelen+xlen); err != nil { 333 if err := preadn(fd, buf, off+30+namelen+xlen); err != nil {
334 return nil, errors.New("corrupt zip file " + zipfile) 334 return nil, errors.New("corrupt zip file " + zipfile)
335 } 335 }
336 336
337 return loadZoneData(buf) 337 return loadZoneData(buf)
338 } 338 }
339 339
340 return nil, errors.New("cannot find " + name + " in zip file " + zipfile ) 340 return nil, errors.New("cannot find " + name + " in zip file " + zipfile )
341 } 341 }
OLDNEW
« no previous file with comments | « src/pkg/time/zoneinfo_plan9.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b