Skip to content

Commit

Permalink
Moves includes into a "cctz" subdirectory.
Browse files Browse the repository at this point in the history
This is a breaking change for users. Callers should now include cctz
header files like:

  #include "cctz/civil_time.h"
  • Loading branch information
devjgm committed Sep 6, 2017
1 parent 0e2dd88 commit 5b17020
Show file tree
Hide file tree
Showing 26 changed files with 58 additions and 55 deletions.
8 changes: 4 additions & 4 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ cc_library(
name = "civil_time",
srcs = ["src/civil_time_detail.cc"],
hdrs = [
"include/civil_time.h",
"include/cctz/civil_time.h",
],
includes = ["include"],
textual_hdrs = ["include/civil_time_detail.h"],
textual_hdrs = ["include/cctz/civil_time_detail.h"],
visibility = ["//visibility:public"],
)

Expand All @@ -47,8 +47,8 @@ cc_library(
"src/tzfile.h",
],
hdrs = [
"include/time_zone.h",
"include/zone_info_source.h",
"include/cctz/time_zone.h",
"include/cctz/zone_info_source.h",
],
includes = ["include"],
visibility = ["//visibility:public"],
Expand Down
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ DESTDIR ?=
## TEST_FLAGS = ...
## TEST_LIBS = ...

VPATH = $(SRC)include:$(SRC)src:$(SRC)examples
VPATH = $(SRC)src:$(SRC)examples
CXXFLAGS += -g -Wall -I$(SRC)include -std=$(STD) \
$(TEST_FLAGS) -fPIC -MMD
ARFLAGS = rcs
Expand All @@ -53,10 +53,7 @@ CCTZ = cctz
CCTZ_LIB = lib$(CCTZ).a
CCTZ_SHARED_LIB = lib$(CCTZ).so

CCTZ_HDRS = \
civil_time.h \
civil_time_detail.h \
time_zone.h
CCTZ_HDRS = $(SRC)/include/cctz/*.h

CCTZ_OBJS = \
civil_time_detail.o \
Expand Down Expand Up @@ -87,8 +84,8 @@ $(CCTZ_SHARED_LIB): $(CCTZ_OBJS)
install: install_hdrs install_lib

install_hdrs: $(CCTZ_HDRS)
$(INSTALL) -d $(DESTDIR)$(PREFIX)/include
$(INSTALL) -m 644 -p $? $(DESTDIR)$(PREFIX)/include
$(INSTALL) -d $(DESTDIR)$(PREFIX)/include/cctz
$(INSTALL) -m 644 -p $? $(DESTDIR)$(PREFIX)/include/cctz

install_lib: $(CCTZ_LIB)
$(INSTALL) -d $(DESTDIR)$(PREFIX)/lib
Expand Down
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ zones in a simple and correct manner. The libraries in CCTZ are:

* **The Civil-Time Library** — This is a header-only library that supports
computing with human-scale time, such as dates (which are represented by the
`cctz::civil_day` class). This library is declared in [`include/civil_time.h`](https://github.com/google/cctz/blob/master/include/civil_time.h).
`cctz::civil_day` class). This library is declared in
[`include/cctz/civil_time.h`](https://github.com/google/cctz/blob/master/include/cctz/civil_time.h).
* **The Time-Zone Library** — This library uses the IANA time zone
database that is installed on the system to convert between *absolute time*
and *civil time*. This library is declared in [`include/time_zone.h`](https://github.com/google/cctz/blob/master/include/time_zone.h).
and *civil time*. This library is declared in
[`include/cctz/time_zone.h`](https://github.com/google/cctz/blob/master/include/cctz/time_zone.h).

These libraries are currently known to work on **Linux** and **Mac OS X**. We
are actively interested in help getting them working on Windows. Please contact
Expand All @@ -35,8 +37,10 @@ the sources using your existing build system.
Next Steps:

1. See the documentation for the libraries in CCTZ:
* Civil Time: [`include/civil_time.h`](https://github.com/google/cctz/blob/master/include/civil_time.h)
* Time Zone: [`include/time_zone.h`](https://github.com/google/cctz/blob/master/include/time_zone.h)
* Civil Time:
[`include/cctz/civil_time.h`](https://github.com/google/cctz/blob/master/include/cctz/civil_time.h)
* Time Zone:
[`include/cctz/time_zone.h`](https://github.com/google/cctz/blob/master/include/cctz/time_zone.h)
2. Look at the examples in https://github.com/google/cctz/tree/master/examples
3. Join our mailing list to ask questions and keep informed of changes:
* https://groups.google.com/forum/#!forum/cctz
Expand Down Expand Up @@ -93,10 +97,12 @@ implement the above concepts.
[`<chrono>`](http://en.cppreference.com/w/cpp/chrono)
library without modification. For example, an absolute point in time is
represented by a `std::chrono::time_point`.
* Civil time &mdash; This is implemented by the [`include/civil_time.h`](https://github.com/google/cctz/blob/master/include/civil_time.h) library
* Civil time &mdash; This is implemented by the
[`include/cctz/civil_time.h`](https://github.com/google/cctz/blob/master/include/cctz/civil_time.h) library
that is provided as part of CCTZ. For example, a "date" is represented by a
`cctz::civil_day`.
* Time zone &mdash; This is implemented by the [`include/time_zone.h`](https://github.com/google/cctz/blob/master/include/time_zone.h) library
* Time zone &mdash; This is implemented by the
[`include/cctz/time_zone.h`](https://github.com/google/cctz/blob/master/include/cctz/time_zone.h) library
that is provided as part of CCTZ. For example, a time zone is represented by
an instance of the class `cctz::time_zone`.

Expand All @@ -110,7 +116,7 @@ day happens to be the 29th, we also output the day of the week.

```
#include <iostream>
#include "civil_time.h"
#include "cctz/civil_time.h"
int main() {
for (cctz::civil_day d(2016, 2, 1); d < cctz::civil_month(2016, 3); ++d) {
Expand Down Expand Up @@ -144,8 +150,8 @@ like to see what time it was for our friend watching in Sydney Australia.

```
#include <iostream>
#include "civil_time.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"
int main() {
cctz::time_zone nyc;
Expand Down
4 changes: 2 additions & 2 deletions examples/example1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <iostream>
#include <string>

#include "civil_time.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"

int main() {
cctz::time_zone lax;
Expand Down
2 changes: 1 addition & 1 deletion examples/example2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <iostream>
#include <string>

#include "time_zone.h"
#include "cctz/time_zone.h"

int main() {
const std::string civil_string = "2015-09-22 09:35:00";
Expand Down
4 changes: 2 additions & 2 deletions examples/example3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <iostream>
#include <string>

#include "civil_time.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"

int main() {
cctz::time_zone lax;
Expand Down
4 changes: 2 additions & 2 deletions examples/example4.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <iostream>
#include <string>

#include "civil_time.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"

template <typename D>
cctz::time_point<cctz::sys_seconds> FloorDay(cctz::time_point<D> tp,
Expand Down
4 changes: 2 additions & 2 deletions examples/hello.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#include <iostream>
#include <string>

#include "civil_time.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"

int main() {
cctz::time_zone syd;
Expand Down
2 changes: 1 addition & 1 deletion include/civil_time.h → include/cctz/civil_time.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#ifndef CCTZ_CIVIL_TIME_H_
#define CCTZ_CIVIL_TIME_H_

#include "civil_time_detail.h"
#include "cctz/civil_time_detail.h"

namespace cctz {

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion include/time_zone.h → include/cctz/time_zone.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <string>
#include <utility>

#include "civil_time.h"
#include "cctz/civil_time.h"

namespace cctz {

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/benchmarks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#include <string>
#include <vector>

#include "civil_time.h"
#include "benchmark/benchmark.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"
#include "time_zone_impl.h"

namespace {
Expand Down
2 changes: 1 addition & 1 deletion src/civil_time_detail.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "civil_time_detail.h"
#include "cctz/civil_time_detail.h"

#include <iomanip>
#include <ostream>
Expand Down
2 changes: 1 addition & 1 deletion src/civil_time_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "civil_time.h"
#include "cctz/civil_time.h"

#include <iomanip>
#include <limits>
Expand Down
4 changes: 2 additions & 2 deletions src/time_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#include <sstream>
#include <string>

#include "civil_time.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"
#include "time_zone_impl.h"

// Pulls in the aliases from cctz for brevity.
Expand Down
2 changes: 1 addition & 1 deletion src/time_zone_fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include <string>

#include "time_zone.h"
#include "cctz/time_zone.h"

namespace cctz {

Expand Down
4 changes: 2 additions & 2 deletions src/time_zone_format.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# endif
#endif

#include "time_zone.h"
#include "cctz/time_zone.h"

#include <cctype>
#include <chrono>
Expand All @@ -34,7 +34,7 @@
#include <sstream>
#endif

#include "civil_time.h"
#include "cctz/civil_time.h"
#include "time_zone_if.h"

namespace cctz {
Expand Down
4 changes: 2 additions & 2 deletions src/time_zone_format_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "time_zone.h"
#include "cctz/time_zone.h"

#include <chrono>
#include <iomanip>
#include <sstream>
#include <string>

#include "civil_time.h"
#include "cctz/civil_time.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"

Expand Down
4 changes: 2 additions & 2 deletions src/time_zone_if.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include <memory>
#include <string>

#include "civil_time.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"

namespace cctz {

Expand Down
4 changes: 2 additions & 2 deletions src/time_zone_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
#include <memory>
#include <string>

#include "civil_time.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"
#include "time_zone_if.h"
#include "time_zone_info.h"

Expand Down
2 changes: 1 addition & 1 deletion src/time_zone_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <sstream>
#include <string>

#include "civil_time.h"
#include "cctz/civil_time.h"
#include "time_zone_fixed.h"
#include "time_zone_posix.h"

Expand Down
6 changes: 3 additions & 3 deletions src/time_zone_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
#include <string>
#include <vector>

#include "civil_time.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"
#include "cctz/zone_info_source.h"
#include "time_zone_if.h"
#include "tzfile.h"
#include "zone_info_source.h"

namespace cctz {

Expand Down
4 changes: 2 additions & 2 deletions src/time_zone_libc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <tuple>
#include <utility>

#include "civil_time.h"
#include "time_zone.h"
#include "cctz/civil_time.h"
#include "cctz/time_zone.h"

namespace cctz {

Expand Down
2 changes: 1 addition & 1 deletion src/time_zone_lookup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "time_zone.h"
#include "cctz/time_zone.h"

#include <cstdlib>
#include <cstring>
Expand Down
4 changes: 2 additions & 2 deletions src/time_zone_lookup_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "time_zone.h"
#include "cctz/time_zone.h"

#include <chrono>
#include <cstddef>
Expand All @@ -21,7 +21,7 @@
#include <thread>
#include <vector>

#include "civil_time.h"
#include "cctz/civil_time.h"
#include "gtest/gtest.h"

using std::chrono::time_point_cast;
Expand Down

0 comments on commit 5b17020

Please sign in to comment.