• 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(
25    default_visibility = ["//visibility:public"],
26    features = [
27        "header_modules",
28        "layering_check",
29        "parse_headers",
30    ],
31)
32
33licenses(["notice"])
34
35cc_library(
36    name = "time",
37    srcs = [
38        "civil_time.cc",
39        "clock.cc",
40        "duration.cc",
41        "format.cc",
42        "internal/get_current_time_chrono.inc",
43        "internal/get_current_time_posix.inc",
44        "time.cc",
45    ],
46    hdrs = [
47        "civil_time.h",
48        "clock.h",
49        "time.h",
50    ],
51    copts = ABSL_DEFAULT_COPTS,
52    linkopts = ABSL_DEFAULT_LINKOPTS,
53    deps = [
54        "//absl/base",
55        "//absl/base:config",
56        "//absl/base:core_headers",
57        "//absl/base:raw_logging_internal",
58        "//absl/numeric:int128",
59        "//absl/strings",
60        "//absl/strings:string_view",
61        "//absl/time/internal/cctz:civil_time",
62        "//absl/time/internal/cctz:time_zone",
63        "//absl/types:optional",
64    ],
65)
66
67cc_library(
68    name = "test_util",
69    testonly = True,
70    srcs = ["internal/test_util.cc"],
71    hdrs = ["internal/test_util.h"],
72    copts = ABSL_DEFAULT_COPTS,
73    linkopts = ABSL_DEFAULT_LINKOPTS,
74    visibility = ["//visibility:private"],
75    deps = [
76        ":time",
77        "//absl/base:config",
78        "//absl/base:raw_logging_internal",
79    ],
80)
81
82cc_test(
83    name = "time_test",
84    srcs = [
85        "civil_time_test.cc",
86        "clock_test.cc",
87        "duration_test.cc",
88        "format_test.cc",
89        "time_test.cc",
90        "time_zone_test.cc",
91    ],
92    copts = ABSL_TEST_COPTS,
93    data = ["//absl/time/internal/cctz:zoneinfo"],
94    linkopts = ABSL_DEFAULT_LINKOPTS,
95    deps = [
96        ":test_util",
97        ":time",
98        "//absl/base:config",
99        "//absl/base:core_headers",
100        "//absl/hash:hash_testing",
101        "//absl/numeric:int128",
102        "//absl/strings:str_format",
103        "//absl/time/internal/cctz:time_zone",
104        "@googletest//:gtest",
105        "@googletest//:gtest_main",
106    ],
107)
108
109cc_test(
110    name = "flag_test",
111    srcs = [
112        "flag_test.cc",
113    ],
114    copts = ABSL_TEST_COPTS,
115    linkopts = ABSL_DEFAULT_LINKOPTS,
116    tags = [
117        "no_test_android_arm",
118        "no_test_android_arm64",
119        "no_test_android_x86",
120        "no_test_ios_x86_64",
121        "no_test_lexan",
122        "no_test_loonix",
123        "no_test_wasm",
124    ],
125    deps = [
126        ":time",
127        "//absl/flags:flag",
128        "//absl/flags:reflection",
129        "@googletest//:gtest",
130        "@googletest//:gtest_main",
131    ],
132)
133
134cc_test(
135    name = "time_benchmark",
136    srcs = [
137        "civil_time_benchmark.cc",
138        "clock_benchmark.cc",
139        "duration_benchmark.cc",
140        "format_benchmark.cc",
141        "time_benchmark.cc",
142    ],
143    copts = ABSL_TEST_COPTS,
144    data = ["//absl/time/internal/cctz:zoneinfo"],
145    linkopts = ABSL_DEFAULT_LINKOPTS,
146    tags = [
147        "benchmark",
148    ],
149    deps = [
150        ":test_util",
151        ":time",
152        "//absl/base",
153        "//absl/base:core_headers",
154        "//absl/flags:flag",
155        "//absl/hash",
156        "@google_benchmark//:benchmark_main",
157    ],
158)
159