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/time/internal/cctz:civil_time", 61 "//absl/time/internal/cctz:time_zone", 62 "//absl/types:optional", 63 ], 64) 65 66cc_library( 67 name = "test_util", 68 testonly = True, 69 srcs = ["internal/test_util.cc"], 70 hdrs = ["internal/test_util.h"], 71 copts = ABSL_DEFAULT_COPTS, 72 linkopts = ABSL_DEFAULT_LINKOPTS, 73 visibility = ["//visibility:private"], 74 deps = [ 75 ":time", 76 "//absl/base:config", 77 "//absl/base:raw_logging_internal", 78 ], 79) 80 81cc_test( 82 name = "time_test", 83 srcs = [ 84 "civil_time_test.cc", 85 "clock_test.cc", 86 "duration_test.cc", 87 "format_test.cc", 88 "time_test.cc", 89 "time_zone_test.cc", 90 ], 91 copts = ABSL_TEST_COPTS, 92 data = ["//absl/time/internal/cctz:zoneinfo"], 93 env = {"TZDIR": "absl/time/internal/cctz/testdata/zoneinfo"}, 94 linkopts = ABSL_DEFAULT_LINKOPTS, 95 deps = [ 96 ":test_util", 97 ":time", 98 "//absl/base:config", 99 "//absl/base:core_headers", 100 "//absl/numeric:int128", 101 "//absl/strings:str_format", 102 "//absl/time/internal/cctz:time_zone", 103 "@com_google_googletest//:gtest", 104 "@com_google_googletest//:gtest_main", 105 ], 106) 107 108cc_test( 109 name = "flag_test", 110 srcs = [ 111 "flag_test.cc", 112 ], 113 copts = ABSL_TEST_COPTS, 114 linkopts = ABSL_DEFAULT_LINKOPTS, 115 tags = [ 116 "no_test_android_arm", 117 "no_test_android_arm64", 118 "no_test_android_x86", 119 "no_test_ios_x86_64", 120 "no_test_lexan", 121 "no_test_loonix", 122 "no_test_wasm", 123 ], 124 deps = [ 125 ":time", 126 "//absl/flags:flag", 127 "//absl/flags:reflection", 128 "@com_google_googletest//:gtest", 129 "@com_google_googletest//:gtest_main", 130 ], 131) 132 133cc_test( 134 name = "time_benchmark", 135 srcs = [ 136 "civil_time_benchmark.cc", 137 "clock_benchmark.cc", 138 "duration_benchmark.cc", 139 "format_benchmark.cc", 140 "time_benchmark.cc", 141 ], 142 copts = ABSL_TEST_COPTS, 143 data = ["//absl/time/internal/cctz:zoneinfo"], 144 env = {"TZDIR": "absl/time/internal/cctz/testdata/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 "@com_github_google_benchmark//:benchmark_main", 157 ], 158) 159