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

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

Issue 163085: code review 163085: move ReadFile, WriteFile, and ReadDir into a separate i... (Closed)
Patch Set: code review 163085: move ReadFile, WriteFile, and ReadDir into a separate i... Created 15 years, 4 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/path/path.go ('k') | test/bench/k-nucleotide.go » ('j') | 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
11 11
12 import ( 12 import (
13 » "io"; 13 » "io/ioutil";
14 "once"; 14 "once";
15 "os"; 15 "os";
16 ) 16 )
17 17
18 const ( 18 const (
19 headerSize = 4 + 16 + 4*7; 19 headerSize = 4 + 16 + 4*7;
20 zoneDir = "/usr/share/zoneinfo/"; 20 zoneDir = "/usr/share/zoneinfo/";
21 ) 21 )
22 22
23 // Simple I/O interface to binary blob of data. 23 // Simple I/O interface to binary blob of data.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 zt[i].isstd = isstd[i] != 0 188 zt[i].isstd = isstd[i] != 0
189 } 189 }
190 if i < len(isutc) { 190 if i < len(isutc) {
191 zt[i].isutc = isutc[i] != 0 191 zt[i].isutc = isutc[i] != 0
192 } 192 }
193 } 193 }
194 return zt, true; 194 return zt, true;
195 } 195 }
196 196
197 func readinfofile(name string) ([]zonetime, bool) { 197 func readinfofile(name string) ([]zonetime, bool) {
198 » buf, err := io.ReadFile(name); 198 » buf, err := ioutil.ReadFile(name);
199 if err != nil { 199 if err != nil {
200 return nil, false 200 return nil, false
201 } 201 }
202 return parseinfo(buf); 202 return parseinfo(buf);
203 } 203 }
204 204
205 var zones []zonetime 205 var zones []zonetime
206 206
207 func setupZone() { 207 func setupZone() {
208 // consult $TZ to find the time zone to use. 208 // consult $TZ to find the time zone to use.
(...skipping 24 matching lines...) Expand all
233 m := len(tz) / 2; 233 m := len(tz) / 2;
234 if sec < int64(tz[m].time) { 234 if sec < int64(tz[m].time) {
235 tz = tz[0:m] 235 tz = tz[0:m]
236 } else { 236 } else {
237 tz = tz[m:] 237 tz = tz[m:]
238 } 238 }
239 } 239 }
240 z := tz[0].zone; 240 z := tz[0].zone;
241 return z.name, z.utcoff; 241 return z.name, z.utcoff;
242 } 242 }
OLDNEW
« no previous file with comments | « src/pkg/path/path.go ('k') | test/bench/k-nucleotide.go » ('j') | no next file with comments »

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