• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright 2017 The Abseil Authors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      https://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17load(
18    "//absl:copts/configure_copts.bzl",
19    "ABSL_DEFAULT_COPTS",
20    "ABSL_DEFAULT_LINKOPTS",
21    "ABSL_TEST_COPTS",
22)
23
24package(default_visibility = ["//visibility:public"])
25
26licenses(["notice"])
27
28cc_library(
29    name = "time",
30    srcs = [
31        "civil_time.cc",
32        "clock.cc",
33        "duration.cc",
34        "format.cc",
35        "internal/get_current_time_chrono.inc",
36        "internal/get_current_time_posix.inc",
37        "time.cc",
38    ],
39    hdrs = [
40        "civil_time.h",
41        "clock.h",
42        "time.h",
43    ],
44    copts = ABSL_DEFAULT_COPTS,
45    linkopts = ABSL_DEFAULT_LINKOPTS,
46    deps = [
47        "//absl/base",
48        "//absl/base:config",
49        "//absl/base:core_headers",
50        "//absl/base:raw_logging_internal",
51        "//absl/numeric:int128",
52        "//absl/strings",
53        "//absl/time/internal/cctz:civil_time",
54        "//absl/time/internal/cctz:time_zone",
55        "//absl/types:optional",
56    ],
57)
58
59cc_library(
60    name = "test_util",
61    testonly = 1,
62    srcs = ["internal/test_util.cc"],
63    hdrs = ["internal/test_util.h"],
64    copts = ABSL_DEFAULT_COPTS,
65    linkopts = ABSL_DEFAULT_LINKOPTS,
66    visibility = ["//visibility:private"],
67    deps = [
68        ":time",
69        "//absl/base:config",
70        "//absl/base:raw_logging_internal",
71    ],
72)
73
74cc_test(
75    name = "time_test",
76    srcs = [
77        "civil_time_test.cc",
78        "clock_test.cc",
79        "duration_test.cc",
80        "format_test.cc",
81        "time_test.cc",
82        "time_zone_test.cc",
83    ],
84    copts = ABSL_TEST_COPTS,
85    data = ["//absl/time/internal/cctz:zoneinfo"],
86    env = {"TZDIR": "absl/time/internal/cctz/testdata/zoneinfo"},
87    linkopts = ABSL_DEFAULT_LINKOPTS,
88    deps = [
89        ":test_util",
90        ":time",
91        "//absl/base:config",
92        "//absl/base:core_headers",
93        "//absl/numeric:int128",
94        "//absl/strings:str_format",
95        "//absl/time/internal/cctz:time_zone",
96        "@com_google_googletest//:gtest_main",
97    ],
98)
99
100cc_test(
101    name = "flag_test",
102    srcs = [
103        "flag_test.cc",
104    ],
105    copts = ABSL_TEST_COPTS,
106    linkopts = ABSL_DEFAULT_LINKOPTS,
107    tags = [
108        "no_test_android_arm",
109        "no_test_android_arm64",
110        "no_test_android_x86",
111        "no_test_ios_x86_64",
112        "no_test_lexan",
113        "no_test_loonix",
114        "no_test_wasm",
115    ],
116    deps = [
117        ":time",
118        "//absl/flags:flag",
119        "//absl/flags:reflection",
120        "@com_google_googletest//:gtest_main",
121    ],
122)
123
124cc_test(
125    name = "time_benchmark",
126    srcs = [
127        "civil_time_benchmark.cc",
128        "clock_benchmark.cc",
129        "duration_benchmark.cc",
130        "format_benchmark.cc",
131        "time_benchmark.cc",
132    ],
133    copts = ABSL_TEST_COPTS,
134    data = ["//absl/time/internal/cctz:zoneinfo"],
135    env = {"TZDIR": "absl/time/internal/cctz/testdata/zoneinfo"},
136    linkopts = ABSL_DEFAULT_LINKOPTS,
137    tags = [
138        "benchmark",
139    ],
140    deps = [
141        ":test_util",
142        ":time",
143        "//absl/base",
144        "//absl/base:core_headers",
145        "//absl/flags:flag",
146        "//absl/hash",
147        "@com_github_google_benchmark//:benchmark_main",
148    ],
149)
150