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("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") 18load( 19 "//absl:copts/configure_copts.bzl", 20 "ABSL_DEFAULT_COPTS", 21 "ABSL_DEFAULT_LINKOPTS", 22 "ABSL_TEST_COPTS", 23) 24 25package(default_visibility = ["//visibility:public"]) 26 27licenses(["notice"]) 28 29cc_library( 30 name = "time", 31 srcs = [ 32 "civil_time.cc", 33 "clock.cc", 34 "duration.cc", 35 "format.cc", 36 "internal/get_current_time_chrono.inc", 37 "internal/get_current_time_posix.inc", 38 "time.cc", 39 ], 40 hdrs = [ 41 "civil_time.h", 42 "clock.h", 43 "time.h", 44 ], 45 copts = ABSL_DEFAULT_COPTS, 46 linkopts = ABSL_DEFAULT_LINKOPTS, 47 deps = [ 48 "//absl/base", 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 ], 56) 57 58cc_library( 59 name = "test_util", 60 testonly = 1, 61 srcs = [ 62 "internal/test_util.cc", 63 "internal/zoneinfo.inc", 64 ], 65 hdrs = ["internal/test_util.h"], 66 copts = ABSL_DEFAULT_COPTS, 67 linkopts = ABSL_DEFAULT_LINKOPTS, 68 visibility = [ 69 "//absl/time:__pkg__", 70 ], 71 deps = [ 72 ":time", 73 "//absl/base:config", 74 "//absl/base:raw_logging_internal", 75 "//absl/time/internal/cctz:time_zone", 76 "@com_google_googletest//:gtest", 77 ], 78) 79 80cc_test( 81 name = "time_test", 82 srcs = [ 83 "civil_time_test.cc", 84 "clock_test.cc", 85 "duration_test.cc", 86 "format_test.cc", 87 "time_test.cc", 88 "time_zone_test.cc", 89 ], 90 copts = ABSL_TEST_COPTS, 91 linkopts = ABSL_DEFAULT_LINKOPTS, 92 deps = [ 93 ":test_util", 94 ":time", 95 "//absl/base:config", 96 "//absl/base:core_headers", 97 "//absl/numeric:int128", 98 "//absl/time/internal/cctz:time_zone", 99 "@com_google_googletest//:gtest_main", 100 ], 101) 102 103cc_test( 104 name = "time_benchmark", 105 srcs = [ 106 "civil_time_benchmark.cc", 107 "clock_benchmark.cc", 108 "duration_benchmark.cc", 109 "format_benchmark.cc", 110 "time_benchmark.cc", 111 ], 112 copts = ABSL_TEST_COPTS, 113 linkopts = ABSL_DEFAULT_LINKOPTS, 114 tags = [ 115 "benchmark", 116 ], 117 deps = [ 118 ":test_util", 119 ":time", 120 "//absl/base", 121 "//absl/base:core_headers", 122 "//absl/flags:flag", 123 "//absl/hash", 124 "@com_github_google_benchmark//:benchmark_main", 125 ], 126) 127