Skip to content

Commit 182b96c

Browse files
committed
Merge pull request #21 from google/v2
Merging v2 into master
2 parents 987542f + a9dafaf commit 182b96c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+5476
-2089
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# ignore all files in the bazel directories
22
/bazel-*
3+
# ignore non-bazel build products
4+
/build

BUILD

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# Copyright 2016 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
### libraries
16+
17+
cc_library(
18+
name = "civil_time",
19+
hdrs = [
20+
"include/civil_time.h",
21+
],
22+
includes = ["include"],
23+
textual_hdrs = ["include/civil_time_detail.h"],
24+
visibility = ["//visibility:public"],
25+
)
26+
27+
cc_library(
28+
name = "time_zone",
29+
srcs = [
30+
"src/time_zone_format.cc",
31+
"src/time_zone_if.cc",
32+
"src/time_zone_if.h",
33+
"src/time_zone_impl.cc",
34+
"src/time_zone_impl.h",
35+
"src/time_zone_info.cc",
36+
"src/time_zone_info.h",
37+
"src/time_zone_libc.cc",
38+
"src/time_zone_libc.h",
39+
"src/time_zone_lookup.cc",
40+
"src/time_zone_posix.cc",
41+
"src/time_zone_posix.h",
42+
"src/tzfile.h",
43+
],
44+
hdrs = [
45+
"include/time_zone.h",
46+
],
47+
includes = ["include"],
48+
linkopts = [
49+
"-lm",
50+
"-lpthread",
51+
],
52+
visibility = ["//visibility:public"],
53+
deps = [":civil_time"],
54+
)
55+
56+
cc_library(
57+
name = "cctz_v1",
58+
hdrs = [
59+
"src/cctz.h",
60+
],
61+
includes = ["include"],
62+
visibility = ["//visibility:public"],
63+
deps = [
64+
":civil_time",
65+
":time_zone",
66+
],
67+
)
68+
69+
### tests
70+
71+
# Builds the Google Test source that was fetched from another repository.
72+
cc_library(
73+
name = "gtest",
74+
srcs = glob(
75+
[
76+
"google*/src/*.cc",
77+
],
78+
exclude = glob([
79+
"google*/src/*-all.cc",
80+
"googlemock/src/gmock_main.cc",
81+
]),
82+
),
83+
hdrs = glob(["*/include/**/*.h"]),
84+
includes = [
85+
"googlemock/",
86+
"googlemock/include",
87+
"googletest/",
88+
"googletest/include",
89+
],
90+
linkopts = ["-pthread"],
91+
textual_hdrs = ["googletest/src/gtest-internal-inl.h"],
92+
visibility = ["//visibility:public"],
93+
)
94+
95+
cc_test(
96+
name = "civil_time_test",
97+
size = "small",
98+
srcs = ["src/civil_time_test.cc"],
99+
deps = [
100+
"@gtest//:gtest",
101+
":civil_time",
102+
],
103+
)
104+
105+
cc_test(
106+
name = "time_zone_format_test",
107+
size = "small",
108+
srcs = ["src/time_zone_format_test.cc"],
109+
deps = [
110+
"@gtest//:gtest",
111+
":civil_time",
112+
":time_zone",
113+
],
114+
)
115+
116+
cc_test(
117+
name = "time_zone_lookup_test",
118+
size = "small",
119+
srcs = ["src/time_zone_lookup_test.cc"],
120+
deps = [
121+
"@gtest//:gtest",
122+
":civil_time",
123+
":time_zone",
124+
],
125+
)
126+
127+
cc_test(
128+
name = "cctz_v1_test",
129+
size = "small",
130+
srcs = ["src/cctz_v1_test.cc"],
131+
defines = ["CCTZ_ACK_V1_DEPRECATION=1"],
132+
deps = [
133+
"@gtest//:gtest",
134+
":cctz_v1",
135+
],
136+
)
137+
138+
### examples
139+
140+
cc_binary(
141+
name = "classic",
142+
srcs = ["examples/classic.cc"],
143+
)
144+
145+
cc_binary(
146+
name = "epoch_shift",
147+
srcs = ["examples/epoch_shift.cc"],
148+
deps = [
149+
":civil_time",
150+
":time_zone",
151+
],
152+
)
153+
154+
cc_binary(
155+
name = "example1",
156+
srcs = ["examples/example1.cc"],
157+
deps = [
158+
":civil_time",
159+
":time_zone",
160+
],
161+
)
162+
163+
cc_binary(
164+
name = "example2",
165+
srcs = ["examples/example2.cc"],
166+
deps = [
167+
":civil_time",
168+
":time_zone",
169+
],
170+
)
171+
172+
cc_binary(
173+
name = "example3",
174+
srcs = ["examples/example3.cc"],
175+
deps = [
176+
":civil_time",
177+
":time_zone",
178+
],
179+
)
180+
181+
cc_binary(
182+
name = "example4",
183+
srcs = ["examples/example4.cc"],
184+
deps = [
185+
":civil_time",
186+
":time_zone",
187+
],
188+
)
189+
190+
cc_binary(
191+
name = "hello",
192+
srcs = ["examples/hello.cc"],
193+
deps = [
194+
":civil_time",
195+
":time_zone",
196+
],
197+
)
198+
199+
### binaries
200+
201+
cc_binary(
202+
name = "time_tool",
203+
srcs = ["src/time_tool.cc"],
204+
deps = [
205+
":civil_time",
206+
":time_zone",
207+
],
208+
)

CONTRIBUTING.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
1-
Want to contribute? Great! First, read this page (including the small print at the end).
1+
Want to contribute? Great! First, read this page (including the small print at
2+
the end).
23

34
### Before you contribute
4-
Before we can use your code, you must sign the
5-
[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
6-
(CLA), which you can do online. The CLA is necessary mainly because you own the
7-
copyright to your changes, even after your contribution becomes part of our
8-
codebase, so we need your permission to use and distribute your code. We also
9-
need to be sure of various other things—for instance that you'll tell us if you
10-
know that your code infringes on other people's patents. You don't have to sign
11-
the CLA until after you've submitted your code for review and a member has
12-
approved it, but you must do it before we can put your code into our codebase.
13-
Before you start working on a larger contribution, you should get in touch with
14-
us first through the issue tracker with your idea so that we can help out and
15-
possibly guide you. Coordinating up front makes it much easier to avoid
16-
frustration later on.
5+
6+
Before we can use your code, you must sign the [Google Individual Contributor
7+
License Agreement]
8+
(https://developers.google.com/open-source/cla/individual?csw=1) (CLA), which
9+
you can do online. The CLA is necessary mainly because you own the copyright to
10+
your changes, even after your contribution becomes part of our codebase, so we
11+
need your permission to use and distribute your code. We also need to be sure of
12+
various other things—for instance that you'll tell us if you know that
13+
your code infringes on other people's patents. You don't have to sign the CLA
14+
until after you've submitted your code for review and a member has approved it,
15+
but you must do it before we can put your code into our codebase. Before you
16+
start working on a larger contribution, you should get in touch with us first
17+
through the issue tracker with your idea so that we can help out and possibly
18+
guide you. Coordinating up front makes it much easier to avoid frustration later
19+
on.
1720

1821
### Code reviews
22+
1923
All submissions, including submissions by project members, require review. We
2024
use Github pull requests for this purpose.
2125

2226
### The small print
23-
Contributions made by corporations are covered by a different agreement than
24-
the one above, the Software Grant and Corporate Contributor License Agreement.
27+
28+
Contributions made by corporations are covered by a different agreement than the
29+
one above, the Software Grant and Corporate Contributor License Agreement.

Makefile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Copyright 2016 Google Inc. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# While Bazel (http://bazel.io) is the primary build system used by cctz,
16+
# this Makefile is provided as a convenience for those who can't use Bazel
17+
# and can't compile the sources in their own build system.
18+
#
19+
# Suggested usage:
20+
# make -C build -f ../Makefile SRC=../ -j `nproc`
21+
22+
# local configuration
23+
CXX = g++
24+
STD = c++11
25+
OPT = -O
26+
PREFIX = /usr/local
27+
28+
# possible support for googletest
29+
## TESTS = civil_time_test time_zone_lookup_test time_zone_format_test
30+
## TEST_FLAGS = ...
31+
## TEST_LIBS = ...
32+
33+
VPATH = $(SRC)include:$(SRC)src:$(SRC)examples
34+
CC = $(CXX)
35+
CPPFLAGS = -Wall -I$(SRC)include -std=$(STD) -pthread \
36+
$(TEST_FLAGS) $(OPT) -fPIC -MMD
37+
ARFLAGS = rcs
38+
LDFLAGS = -pthread
39+
LDLIBS = $(TEST_LIBS)
40+
41+
CCTZ_LIB = libcctz.a
42+
43+
CCTZ_HDRS = \
44+
civil_time.h \
45+
civil_time_detail.h \
46+
time_zone.h
47+
48+
CCTZ_OBJS = \
49+
time_zone_format.o \
50+
time_zone_if.o \
51+
time_zone_impl.o \
52+
time_zone_info.o \
53+
time_zone_libc.o \
54+
time_zone_lookup.o \
55+
time_zone_posix.o
56+
57+
TOOLS = time_tool
58+
EXAMPLES = classic epoch_shift hello example1 example2 example3 example4
59+
60+
all: $(TESTS) $(TOOLS) $(EXAMPLES)
61+
62+
$(TESTS) $(TOOLS) $(EXAMPLES): $(CCTZ_LIB)
63+
64+
$(CCTZ_LIB): $(CCTZ_OBJS)
65+
$(AR) $(ARFLAGS) $@ $(CCTZ_OBJS)
66+
67+
install: $(CCTZ_HDRS) $(CCTZ_LIB)
68+
sudo cp -p $(CCTZ_HDRS) $(PREFIX)/include
69+
sudo cp -p $(CCTZ_LIB) $(PREFIX)/lib
70+
71+
clean:
72+
@$(RM) -r $(EXAMPLES:=.dSYM) $(EXAMPLES:=.o) $(EXAMPLES:=.d) $(EXAMPLES)
73+
@$(RM) -r $(TOOLS:=.dSYM) $(TOOLS:=.o) $(TOOLS:=.d) $(TOOLS)
74+
@$(RM) -r $(TESTS:=.dSYM) $(TESTS:=.o) $(TESTS:=.d) $(TESTS)
75+
@$(RM) $(CCTZ_OBJS) $(CCTZ_OBJS:.o=.d) $(CCTZ_LIB)
76+
77+
-include $(CCTZ_OBJS:.o=.d) $(TESTS:=.d) $(TOOLS:=.d) $(EXAMPLES:=.d)

0 commit comments

Comments
 (0)