集成时区包

pull/25/merge
Minho 2017-05-09 10:18:10 +08:00
parent e88e60622d
commit 523bc7959e
7 changed files with 64 additions and 590195 deletions

View File

@ -21,7 +21,7 @@ before_deploy:
- GOARCH=amd64 GOOS=linux go build -o godoc_linux_amd64 -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'"
- GOARCH=amd64 GOOS=darwin go build -o godoc_darwin_amd64 -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'"
- GOARCH=amd64 GOOS=windows go build -o godoc_windows_amd64.exe -ldflags="-w -X main.VERSION=$TAG -X 'main.BUILD_TIME=`date`' -X 'main.GO_VERSION=`go version`'"
- rm -rf commands controllers models modules routers tasks vendor docs search data utils graphics .git Godeps uploads/* .gitignore .travis.yml Dockerfile gide.yaml LICENSE main.go README.md conf/enumerate.go conf/mail.go install.lock *.md
- rm -rf commands controllers models modules routers tasks vendor docs search utils graphics .git Godeps uploads/* .gitignore .travis.yml Dockerfile gide.yaml LICENSE main.go README.md conf/enumerate.go conf/mail.go install.lock *.md
- zip -r godoc_linux_amd64.zip conf logs static uploads views godoc_linux_amd64
- zip -r godoc_darwin_amd64.zip conf logs static uploads views godoc_darwin_amd64
- zip -r godoc_windows_amd64.zip conf logs static uploads views godoc_windows_amd64.exe

View File

@ -14,6 +14,7 @@ import (
"github.com/lifei6671/godoc/conf"
"github.com/lifei6671/gocaptcha"
"syscall"
)
// RegisterDataBase 注册数据库
@ -32,7 +33,6 @@ func RegisterDataBase() {
orm.RegisterDataBase("default", "mysql", dataSource)
orm.DefaultTimeLoc, _ = time.LoadLocation(timezone)
}
// RegisterModel 注册Model
@ -146,6 +146,7 @@ func RegisterFunction() {
}
func init() {
syscall.Setenv("ZONEINFO","./lib/time/zoneinfo.zip")
gocaptcha.ReadFonts("./static/fonts", ".ttf")
gob.Register(models.Member{})
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

10
lib/time/README 100644
View File

@ -0,0 +1,10 @@
The zoneinfo.zip archive contains time zone files compiled using
the code and data maintained as part of the IANA Time Zone Database.
The IANA asserts that the database is in the public domain.
For more information, see
http://www.iana.org/time-zones
ftp://ftp.iana.org/tz/code/tz-link.htm
http://tools.ietf.org/html/rfc6557
To rebuild the archive, read and run update.bash.

View File

@ -0,0 +1,51 @@
#!/bin/bash
# Copyright 2012 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.
# This script rebuilds the time zone files using files
# downloaded from the ICANN/IANA distribution.
# Consult http://www.iana.org/time-zones for the latest versions.
# Versions to use.
CODE=2016j
DATA=2016j
set -e
rm -rf work
mkdir work
cd work
mkdir zoneinfo
curl -O http://www.iana.org/time-zones/repository/releases/tzcode$CODE.tar.gz
curl -O http://www.iana.org/time-zones/repository/releases/tzdata$DATA.tar.gz
tar xzf tzcode$CODE.tar.gz
tar xzf tzdata$DATA.tar.gz
# Turn off 64-bit output in time zone files.
# We don't need those until 2037.
perl -p -i -e 's/pass <= 2/pass <= 1/' zic.c
make CFLAGS=-DSTD_INSPIRED AWK=awk TZDIR=zoneinfo posix_only
# America/Los_Angeles should not be bigger than 1100 bytes.
# If it is, we probably failed to disable the 64-bit output, which
# triples the size of the files.
size=$(ls -l zoneinfo/America/Los_Angeles | awk '{print $5}')
if [ $size -gt 1200 ]; then
echo 'zone file too large; 64-bit edit failed?' >&2
exit 2
fi
cd zoneinfo
rm -f ../../zoneinfo.zip
zip -0 -r ../../zoneinfo.zip *
cd ../..
echo
if [ "$1" == "-work" ]; then
echo Left workspace behind in work/.
else
rm -rf work
fi
echo New time zone files in zoneinfo.zip.

Binary file not shown.