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"]) # Apache 2.0 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:raw_logging_internal", 74 "//absl/time/internal/cctz:time_zone", 75 "@com_google_googletest//:gtest", 76 ], 77) 78 79cc_test( 80 name = "time_test", 81 srcs = [ 82 "civil_time_test.cc", 83 "clock_test.cc", 84 "duration_test.cc", 85 "format_test.cc", 86 "time_test.cc", 87 "time_zone_test.cc", 88 ], 89 copts = ABSL_TEST_COPTS, 90 linkopts = ABSL_DEFAULT_LINKOPTS, 91 deps = [ 92 ":test_util", 93 ":time", 94 "//absl/base:config", 95 "//absl/base:core_headers", 96 "//absl/numeric:int128", 97 "//absl/time/internal/cctz:time_zone", 98 "@com_google_googletest//:gtest_main", 99 ], 100) 101 102cc_test( 103 name = "time_benchmark", 104 srcs = [ 105 "civil_time_benchmark.cc", 106 "clock_benchmark.cc", 107 "duration_benchmark.cc", 108 "format_benchmark.cc", 109 "time_benchmark.cc", 110 ], 111 copts = ABSL_TEST_COPTS, 112 linkopts = ABSL_DEFAULT_LINKOPTS, 113 tags = [ 114 "benchmark", 115 ], 116 deps = [ 117 ":test_util", 118 ":time", 119 "//absl/base", 120 "//absl/base:core_headers", 121 "//absl/hash", 122 "@com_github_google_benchmark//:benchmark_main", 123 ], 124) 125