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/time/internal/cctz:time_zone", 95 "@com_google_googletest//:gtest_main", 96 ], 97) 98 99cc_test( 100 name = "flag_test", 101 srcs = [ 102 "flag_test.cc", 103 ], 104 copts = ABSL_TEST_COPTS, 105 linkopts = ABSL_DEFAULT_LINKOPTS, 106 tags = [ 107 "no_test_android_arm", 108 "no_test_android_arm64", 109 "no_test_android_x86", 110 "no_test_ios_x86_64", 111 "no_test_lexan", 112 "no_test_loonix", 113 "no_test_wasm", 114 ], 115 deps = [ 116 ":time", 117 "//absl/flags:flag", 118 "//absl/flags:reflection", 119 "@com_google_googletest//:gtest_main", 120 ], 121) 122 123cc_test( 124 name = "time_benchmark", 125 srcs = [ 126 "civil_time_benchmark.cc", 127 "clock_benchmark.cc", 128 "duration_benchmark.cc", 129 "format_benchmark.cc", 130 "time_benchmark.cc", 131 ], 132 copts = ABSL_TEST_COPTS, 133 data = ["//absl/time/internal/cctz:zoneinfo"], 134 env = {"TZDIR": "absl/time/internal/cctz/testdata/zoneinfo"}, 135 linkopts = ABSL_DEFAULT_LINKOPTS, 136 tags = [ 137 "benchmark", 138 ], 139 deps = [ 140 ":test_util", 141 ":time", 142 "//absl/base", 143 "//absl/base:core_headers", 144 "//absl/flags:flag", 145 "//absl/hash", 146 "@com_github_google_benchmark//:benchmark_main", 147 ], 148) 149