| 1 | /* |
| 2 | Copyright (C) 2016-2018 Brazil |
| 3 | Copyright (C) 2021-2022 Sutou Kouhei <[email protected]> |
| 4 | |
| 5 | This library is free software; you can redistribute it and/or |
| 6 | modify it under the terms of the GNU Lesser General Public |
| 7 | License as published by the Free Software Foundation; either |
| 8 | version 2.1 of the License, or (at your option) any later version. |
| 9 | |
| 10 | This library is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | Lesser General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU Lesser General Public |
| 16 | License along with this library; if not, write to the Free Software |
| 17 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | */ |
| 19 | |
| 20 | #ifdef GRN_EMBEDDED |
| 21 | # define GRN_PLUGIN_FUNCTION_TAG functions_time |
| 22 | #endif /* GRN_EMBEDDED */ |
| 23 | |
| 24 | #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:410:9`! |
| 25 | # include <config.h>cxx . . $ `<file>/build/config.h`/ |
| 26 | #endif /* HAVE_CONFIG_H */ |
| 27 | |
| 28 | #include <groonga/plugin.h>cxx . . $ `<file>/include/groonga/plugin.h`/ |
| 29 | |
| 30 | #include <math.h> |
| 31 | #include <stdlib.h> |
| 32 | #include <time.h> |
| 33 | |
| 34 | #ifdef WIN32 |
| 35 | # define timegm _mkgmtime |
| 36 | # define HAVE_TIMEGM |
| 37 | #else /* WIN32 */ |
| 38 | # define HAVE_TIMEGMcxx . . $ `plugins/functions/time.c:38:10`! |
| 39 | #endif /* WIN32 */ |
| 40 | |
| 41 | typedef enumcxx . . $ $anonymous_type_6fab4b7fb88c7359_0# { |
| 42 | GRN_TIME_CLASSIFY_UNIT_SECONDcxx . . $ GRN_TIME_CLASSIFY_UNIT_SECOND., |
| 43 | GRN_TIME_CLASSIFY_UNIT_MINUTEcxx . . $ GRN_TIME_CLASSIFY_UNIT_MINUTE., |
| 44 | GRN_TIME_CLASSIFY_UNIT_HOURcxx . . $ GRN_TIME_CLASSIFY_UNIT_HOUR., |
| 45 | GRN_TIME_CLASSIFY_UNIT_DAYcxx . . $ GRN_TIME_CLASSIFY_UNIT_DAY., |
| 46 | GRN_TIME_CLASSIFY_UNIT_WEEKcxx . . $ GRN_TIME_CLASSIFY_UNIT_WEEK., |
| 47 | GRN_TIME_CLASSIFY_UNIT_MONTHcxx . . $ GRN_TIME_CLASSIFY_UNIT_MONTH., |
| 48 | GRN_TIME_CLASSIFY_UNIT_YEARcxx . . $ GRN_TIME_CLASSIFY_UNIT_YEAR. |
| 49 | } grn_time_classify_unitcxx . . $ grn_time_classify_unit#; |
| 50 | |
| 51 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 52 | func_time_classify_raw_computecxx . . $ func_time_classify_raw_compute(e0765b445b3e76c1).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 53 | grn_objcxx . . $ grn_obj# *time, |
| 54 | grn_time_classify_unitcxx . . $ grn_time_classify_unit# unit, |
| 55 | uint32_tcxx . . $ uint32_t# interval_raw, |
| 56 | int64_tcxx . . $ int64_t# *classed_time_raw, |
| 57 | const char *function_name) |
| 58 | { |
| 59 | int64_tcxx . . $ int64_t# time_raw; |
| 60 | struct tmcxx . . $ tm# tm; |
| 61 | |
| 62 | if (time->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. != GRN_DB_TIMEcxx . . $ GRN_DB_TIME.) { |
| 63 | grn_objcxx . . $ grn_obj# inspected; |
| 64 | |
| 65 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 66 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, time); |
| 67 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 68 | "%s(): " |
| 69 | "the first argument must be a time: " |
| 70 | "<%.*s>", |
| 71 | function_name, |
| 72 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 73 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 74 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 75 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 76 | } |
| 77 | |
| 78 | time_raw = GRN_TIME_VALUEcxx . . $ `include/groonga/groonga.h:3109:9`!(time); |
| 79 | if (!grn_time_to_tmcxx . . $ grn_time_to_tm(f8a68ae4da1a7edf).(ctx, time_raw, &tm)) { |
| 80 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 81 | } |
| 82 | |
| 83 | struct tmcxx . . $ tm# tm_timezone_offset; |
| 84 | grn_time_to_tmcxx . . $ grn_time_to_tm(f8a68ae4da1a7edf).(ctx, 0, &tm_timezone_offset); |
| 85 | int64_tcxx . . $ int64_t# timezone_offset = 0; |
| 86 | |
| 87 | switch (unit) { |
| 88 | case GRN_TIME_CLASSIFY_UNIT_SECONDcxx . . $ GRN_TIME_CLASSIFY_UNIT_SECOND. : |
| 89 | tm.tm_seccxx . . $ tm#tm_sec. = (tm.tm_seccxx . . $ tm#tm_sec. / (int)interval_raw) * (int)interval_raw; |
| 90 | break; |
| 91 | case GRN_TIME_CLASSIFY_UNIT_MINUTEcxx . . $ GRN_TIME_CLASSIFY_UNIT_MINUTE. : |
| 92 | tm.tm_mincxx . . $ tm#tm_min. = (tm.tm_mincxx . . $ tm#tm_min. / (int)interval_raw) * (int)interval_raw; |
| 93 | tm.tm_seccxx . . $ tm#tm_sec. = 0; |
| 94 | break; |
| 95 | case GRN_TIME_CLASSIFY_UNIT_HOURcxx . . $ GRN_TIME_CLASSIFY_UNIT_HOUR. : |
| 96 | tm.tm_hourcxx . . $ tm#tm_hour. = (tm.tm_hourcxx . . $ tm#tm_hour. / (int)interval_raw) * (int)interval_raw; |
| 97 | tm.tm_mincxx . . $ tm#tm_min. = tm_timezone_offset.tm_mincxx . . $ tm#tm_min.; |
| 98 | tm.tm_seccxx . . $ tm#tm_sec. = 0; |
| 99 | timezone_offset = GRN_TIME_PACKcxx . . $ `include/groonga/time.h:51:9`!((tm_timezone_offset.tm_min * 60), |
| 100 | 0); |
| 101 | break; |
| 102 | case GRN_TIME_CLASSIFY_UNIT_DAYcxx . . $ GRN_TIME_CLASSIFY_UNIT_DAY. : |
| 103 | tm.tm_hourcxx . . $ tm#tm_hour. = tm_timezone_offset.tm_hourcxx . . $ tm#tm_hour.; |
| 104 | tm.tm_mincxx . . $ tm#tm_min. = tm_timezone_offset.tm_mincxx . . $ tm#tm_min.; |
| 105 | tm.tm_seccxx . . $ tm#tm_sec. = 0; |
| 106 | timezone_offset = GRN_TIME_PACKcxx . . $ `include/groonga/time.h:51:9`!((tm_timezone_offset.tm_hour * 60 * 60) + |
| 107 | (tm_timezone_offset.tm_min * 60), |
| 108 | 0); |
| 109 | break; |
| 110 | case GRN_TIME_CLASSIFY_UNIT_WEEKcxx . . $ GRN_TIME_CLASSIFY_UNIT_WEEK. : |
| 111 | if ((tm.tm_mdaycxx . . $ tm#tm_mday. - tm.tm_wdaycxx . . $ tm#tm_wday.) >= 0) { |
| 112 | tm.tm_mdaycxx . . $ tm#tm_mday. -= tm.tm_wdaycxx . . $ tm#tm_wday.; |
| 113 | } else { |
| 114 | int n_underflowed_mday = -(tm.tm_mdaycxx . . $ tm#tm_mday. - tm.tm_wdaycxx . . $ tm#tm_wday.); |
| 115 | int mday; |
| 116 | int max_mday = 31; |
| 117 | |
| 118 | if (tm.tm_moncxx . . $ tm#tm_mon. == 0) { |
| 119 | tm.tm_yearcxx . . $ tm#tm_year.--; |
| 120 | tm.tm_moncxx . . $ tm#tm_mon. = 11; |
| 121 | } else { |
| 122 | tm.tm_moncxx . . $ tm#tm_mon.--; |
| 123 | } |
| 124 | |
| 125 | for (mday = max_mday; mday > n_underflowed_mday; mday--) { |
| 126 | int64_tcxx . . $ int64_t# unused; |
| 127 | tm.tm_mdaycxx . . $ tm#tm_mday. = mday; |
| 128 | if (grn_time_from_tmcxx . . $ grn_time_from_tm(b8ef19f68bf75a24).(ctx, &unused, &tm)) { |
| 129 | break; |
| 130 | } |
| 131 | } |
| 132 | tm.tm_mdaycxx . . $ tm#tm_mday. -= n_underflowed_mday; |
| 133 | } |
| 134 | tm.tm_hourcxx . . $ tm#tm_hour. = tm_timezone_offset.tm_hourcxx . . $ tm#tm_hour.; |
| 135 | tm.tm_mincxx . . $ tm#tm_min. = tm_timezone_offset.tm_mincxx . . $ tm#tm_min.; |
| 136 | tm.tm_seccxx . . $ tm#tm_sec. = 0; |
| 137 | timezone_offset = GRN_TIME_PACKcxx . . $ `include/groonga/time.h:51:9`!((tm_timezone_offset.tm_hour * 60 * 60) + |
| 138 | (tm_timezone_offset.tm_min * 60), |
| 139 | 0); |
| 140 | break; |
| 141 | case GRN_TIME_CLASSIFY_UNIT_MONTHcxx . . $ GRN_TIME_CLASSIFY_UNIT_MONTH. : |
| 142 | tm.tm_moncxx . . $ tm#tm_mon. = (tm.tm_moncxx . . $ tm#tm_mon. / (int)interval_raw) * (int)interval_raw; |
| 143 | tm.tm_mdaycxx . . $ tm#tm_mday. = 1; |
| 144 | tm.tm_hourcxx . . $ tm#tm_hour. = tm_timezone_offset.tm_hourcxx . . $ tm#tm_hour.; |
| 145 | tm.tm_mincxx . . $ tm#tm_min. = tm_timezone_offset.tm_mincxx . . $ tm#tm_min.; |
| 146 | tm.tm_seccxx . . $ tm#tm_sec. = 0; |
| 147 | timezone_offset = GRN_TIME_PACKcxx . . $ `include/groonga/time.h:51:9`!((tm_timezone_offset.tm_hour * 60 * 60) + |
| 148 | (tm_timezone_offset.tm_min * 60), |
| 149 | 0); |
| 150 | break; |
| 151 | case GRN_TIME_CLASSIFY_UNIT_YEARcxx . . $ GRN_TIME_CLASSIFY_UNIT_YEAR. : |
| 152 | tm.tm_yearcxx . . $ tm#tm_year. = |
| 153 | (((1900 + tm.tm_yearcxx . . $ tm#tm_year.) / (int)interval_raw) * (int)interval_raw) - |
| 154 | 1900; |
| 155 | tm.tm_moncxx . . $ tm#tm_mon. = 0; |
| 156 | tm.tm_mdaycxx . . $ tm#tm_mday. = 1; |
| 157 | tm.tm_hourcxx . . $ tm#tm_hour. = tm_timezone_offset.tm_hourcxx . . $ tm#tm_hour.; |
| 158 | tm.tm_mincxx . . $ tm#tm_min. = tm_timezone_offset.tm_mincxx . . $ tm#tm_min.; |
| 159 | tm.tm_seccxx . . $ tm#tm_sec. = 0; |
| 160 | timezone_offset = GRN_TIME_PACKcxx . . $ `include/groonga/time.h:51:9`!((tm_timezone_offset.tm_hour * 60 * 60) + |
| 161 | (tm_timezone_offset.tm_min * 60), |
| 162 | 0); |
| 163 | break; |
| 164 | } |
| 165 | |
| 166 | if (!grn_time_from_tmcxx . . $ grn_time_from_tm(b8ef19f68bf75a24).(ctx, classed_time_raw, &tm)) { |
| 167 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 168 | } |
| 169 | *classed_time_raw -= timezone_offset; |
| 170 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 171 | } |
| 172 | |
| 173 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 174 | func_time_classify_raw_validate_arg0cxx . . $ func_time_classify_raw_validate_arg0(9e798f95a6c8217f).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 175 | grn_objcxx . . $ grn_obj# *arg0, |
| 176 | const char *function_name) |
| 177 | { |
| 178 | if (arg0->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_TIMEcxx . . $ GRN_DB_TIME.) { |
| 179 | switch (arg0->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 180 | case GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`! : |
| 181 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`! : |
| 182 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 183 | default : |
| 184 | break; |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | grn_objcxx . . $ grn_obj# inspected; |
| 189 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 190 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, arg0); |
| 191 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 192 | "%s(): " |
| 193 | "the first argument must be a time or a time vector: " |
| 194 | "<%.*s>", |
| 195 | function_name, |
| 196 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 197 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 198 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 199 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 200 | } |
| 201 | |
| 202 | static grn_objcxx . . $ grn_obj# * |
| 203 | func_time_classify_rawcxx . . $ func_time_classify_raw(1a7043a9ed67983c).(grn_ctxcxx . . $ grn_ctx# *ctx, |
| 204 | int n_args, |
| 205 | grn_objcxx . . $ grn_obj# **args, |
| 206 | grn_user_datacxx . . $ grn_user_data# *user_data, |
| 207 | const char *function_name, |
| 208 | grn_time_classify_unitcxx . . $ grn_time_classify_unit# unit) |
| 209 | { |
| 210 | uint32_tcxx . . $ uint32_t# interval_raw = 1; |
| 211 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! accept_interval = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 212 | |
| 213 | switch (unit) { |
| 214 | case GRN_TIME_CLASSIFY_UNIT_SECONDcxx . . $ GRN_TIME_CLASSIFY_UNIT_SECOND. : |
| 215 | case GRN_TIME_CLASSIFY_UNIT_MINUTEcxx . . $ GRN_TIME_CLASSIFY_UNIT_MINUTE. : |
| 216 | case GRN_TIME_CLASSIFY_UNIT_HOURcxx . . $ GRN_TIME_CLASSIFY_UNIT_HOUR. : |
| 217 | accept_interval = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 218 | break; |
| 219 | case GRN_TIME_CLASSIFY_UNIT_DAYcxx . . $ GRN_TIME_CLASSIFY_UNIT_DAY. : |
| 220 | case GRN_TIME_CLASSIFY_UNIT_WEEKcxx . . $ GRN_TIME_CLASSIFY_UNIT_WEEK. : |
| 221 | accept_interval = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 222 | break; |
| 223 | case GRN_TIME_CLASSIFY_UNIT_MONTHcxx . . $ GRN_TIME_CLASSIFY_UNIT_MONTH. : |
| 224 | case GRN_TIME_CLASSIFY_UNIT_YEARcxx . . $ GRN_TIME_CLASSIFY_UNIT_YEAR. : |
| 225 | accept_interval = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 226 | break; |
| 227 | } |
| 228 | |
| 229 | if (accept_interval) { |
| 230 | if (!(n_args == 1 || n_args == 2)) { |
| 231 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 232 | "%s(): " |
| 233 | "wrong number of arguments (%d for 1..2)", |
| 234 | function_name, |
| 235 | n_args); |
| 236 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 237 | } |
| 238 | } else { |
| 239 | if (n_args != 1) { |
| 240 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 241 | "%s(): " |
| 242 | "wrong number of arguments (%d for 1)", |
| 243 | function_name, |
| 244 | n_args); |
| 245 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | grn_objcxx . . $ grn_obj# *arg0 = args[0]; |
| 250 | if (!func_time_classify_raw_validate_arg0cxx . . $ func_time_classify_raw_validate_arg0(9e798f95a6c8217f).(ctx, arg0, function_name)) { |
| 251 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 252 | } |
| 253 | |
| 254 | if (n_args == 2) { |
| 255 | grn_objcxx . . $ grn_obj# *interval; |
| 256 | grn_objcxx . . $ grn_obj# casted_interval; |
| 257 | |
| 258 | interval = args[1]; |
| 259 | if (!(interval->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`! && |
| 260 | grn_type_id_is_number_familycxx . . $ grn_type_id_is_number_family(a2a496425acc5b40).(ctx, interval->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain.))) { |
| 261 | grn_objcxx . . $ grn_obj# inspected; |
| 262 | |
| 263 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 264 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, interval); |
| 265 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 266 | "%s(): " |
| 267 | "the second argument must be a number: " |
| 268 | "<%.*s>", |
| 269 | function_name, |
| 270 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 271 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 272 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 273 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 274 | } |
| 275 | |
| 276 | GRN_VALUE_FIX_SIZE_INITcxx . . $ `include/groonga/groonga.h:2738:9`!(&casted_interval, 0, GRN_DB_UINT32); |
| 277 | grn_obj_castcxx . . $ grn_obj_cast(a6fd93da1614eccd).(ctx, interval, &casted_interval, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!); |
| 278 | interval_raw = GRN_UINT32_VALUEcxx . . $ `include/groonga/groonga.h:3103:9`!(&casted_interval); |
| 279 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &casted_interval); |
| 280 | |
| 281 | if (interval_raw == 0) { |
| 282 | grn_objcxx . . $ grn_obj# inspected; |
| 283 | |
| 284 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 285 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, interval); |
| 286 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 287 | "%s(): " |
| 288 | "the second argument must not be zero: " |
| 289 | "<%.*s>", |
| 290 | function_name, |
| 291 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 292 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 293 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 294 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | switch (arg0->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type.) { |
| 299 | case GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`! : |
| 300 | { |
| 301 | grn_objcxx . . $ grn_obj# *time = arg0; |
| 302 | int64_tcxx . . $ int64_t# classed_time_raw; |
| 303 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! success = func_time_classify_raw_computecxx . . $ func_time_classify_raw_compute(e0765b445b3e76c1).(ctx, |
| 304 | time, |
| 305 | unit, |
| 306 | interval_raw, |
| 307 | &classed_time_raw, |
| 308 | function_name); |
| 309 | if (!success) { |
| 310 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 311 | } |
| 312 | grn_objcxx . . $ grn_obj# *classed_time = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, |
| 313 | user_data, |
| 314 | time->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain., |
| 315 | 0); |
| 316 | if (!classed_time) { |
| 317 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 318 | } |
| 319 | GRN_TIME_SETcxx . . $ `include/groonga/groonga.h:2939:9`!(ctx, classed_time, classed_time_raw); |
| 320 | |
| 321 | return classed_time; |
| 322 | } |
| 323 | break; |
| 324 | case GRN_UVECTORcxx . . $ `include/groonga/groonga.h:875:9`! : |
| 325 | if (arg0->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_TIMEcxx . . $ GRN_DB_TIME.) { |
| 326 | grn_objcxx . . $ grn_obj# *times = arg0; |
| 327 | grn_objcxx . . $ grn_obj# *classed_times = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, |
| 328 | user_data, |
| 329 | times->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain., |
| 330 | GRN_OBJ_VECTORcxx . . $ `include/groonga/groonga.h:2734:9`!); |
| 331 | if (!classed_times) { |
| 332 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 333 | } |
| 334 | |
| 335 | { |
| 336 | size_t i; |
| 337 | size_t n_elements = GRN_TIME_VECTOR_SIZEcxx . . $ `include/groonga/groonga.h:3263:9`!(times); |
| 338 | grn_objcxx . . $ grn_obj# time; |
| 339 | GRN_TIME_INITcxx . . $ `include/groonga/groonga.h:2866:9`!(&time, 0); |
| 340 | for (i = 0; i < n_elements; i++) { |
| 341 | GRN_BULK_REWINDcxx . . $ `include/groonga/groonga.h:2599:9`!(&time); |
| 342 | GRN_TIME_SETcxx . . $ `include/groonga/groonga.h:2939:9`!(ctx, &time, GRN_TIME_VALUE_ATcxx . . $ `include/groonga/groonga.h:3147:9`!(times, i)); |
| 343 | |
| 344 | int64_tcxx . . $ int64_t# classed_time_raw; |
| 345 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! success = func_time_classify_raw_computecxx . . $ func_time_classify_raw_compute(e0765b445b3e76c1).(ctx, |
| 346 | &time, |
| 347 | unit, |
| 348 | interval_raw, |
| 349 | &classed_time_raw, |
| 350 | function_name); |
| 351 | if (!success) { |
| 352 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &time); |
| 353 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 354 | } |
| 355 | |
| 356 | GRN_TIME_PUTcxx . . $ `include/groonga/groonga.h:3212:9`!(ctx, classed_times, classed_time_raw); |
| 357 | } |
| 358 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &time); |
| 359 | |
| 360 | return classed_times; |
| 361 | } |
| 362 | } |
| 363 | break; |
| 364 | } |
| 365 | |
| 366 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 367 | } |
| 368 | |
| 369 | static grn_objcxx . . $ grn_obj# * |
| 370 | func_time_classify_secondcxx . . $ func_time_classify_second(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 371 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 372 | { |
| 373 | return func_time_classify_rawcxx . . $ func_time_classify_raw(1a7043a9ed67983c).(ctx, |
| 374 | n_args, |
| 375 | args, |
| 376 | user_data, |
| 377 | "time_classify_second", |
| 378 | GRN_TIME_CLASSIFY_UNIT_SECONDcxx . . $ GRN_TIME_CLASSIFY_UNIT_SECOND.); |
| 379 | } |
| 380 | |
| 381 | static grn_objcxx . . $ grn_obj# * |
| 382 | func_time_classify_minutecxx . . $ func_time_classify_minute(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 383 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 384 | { |
| 385 | return func_time_classify_rawcxx . . $ func_time_classify_raw(1a7043a9ed67983c).(ctx, |
| 386 | n_args, |
| 387 | args, |
| 388 | user_data, |
| 389 | "time_classify_minute", |
| 390 | GRN_TIME_CLASSIFY_UNIT_MINUTEcxx . . $ GRN_TIME_CLASSIFY_UNIT_MINUTE.); |
| 391 | } |
| 392 | |
| 393 | static grn_objcxx . . $ grn_obj# * |
| 394 | func_time_classify_hourcxx . . $ func_time_classify_hour(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 395 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 396 | { |
| 397 | return func_time_classify_rawcxx . . $ func_time_classify_raw(1a7043a9ed67983c).(ctx, |
| 398 | n_args, |
| 399 | args, |
| 400 | user_data, |
| 401 | "time_classify_hour", |
| 402 | GRN_TIME_CLASSIFY_UNIT_HOURcxx . . $ GRN_TIME_CLASSIFY_UNIT_HOUR.); |
| 403 | } |
| 404 | |
| 405 | static grn_objcxx . . $ grn_obj# * |
| 406 | func_time_classify_daycxx . . $ func_time_classify_day(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 407 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 408 | { |
| 409 | return func_time_classify_rawcxx . . $ func_time_classify_raw(1a7043a9ed67983c).(ctx, |
| 410 | n_args, |
| 411 | args, |
| 412 | user_data, |
| 413 | "time_classify_day", |
| 414 | GRN_TIME_CLASSIFY_UNIT_DAYcxx . . $ GRN_TIME_CLASSIFY_UNIT_DAY.); |
| 415 | } |
| 416 | |
| 417 | static grn_objcxx . . $ grn_obj# * |
| 418 | func_time_classify_weekcxx . . $ func_time_classify_week(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 419 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 420 | { |
| 421 | return func_time_classify_rawcxx . . $ func_time_classify_raw(1a7043a9ed67983c).(ctx, |
| 422 | n_args, |
| 423 | args, |
| 424 | user_data, |
| 425 | "time_classify_week", |
| 426 | GRN_TIME_CLASSIFY_UNIT_WEEKcxx . . $ GRN_TIME_CLASSIFY_UNIT_WEEK.); |
| 427 | } |
| 428 | |
| 429 | static grn_objcxx . . $ grn_obj# * |
| 430 | func_time_classify_monthcxx . . $ func_time_classify_month(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 431 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 432 | { |
| 433 | return func_time_classify_rawcxx . . $ func_time_classify_raw(1a7043a9ed67983c).(ctx, |
| 434 | n_args, |
| 435 | args, |
| 436 | user_data, |
| 437 | "time_classify_month", |
| 438 | GRN_TIME_CLASSIFY_UNIT_MONTHcxx . . $ GRN_TIME_CLASSIFY_UNIT_MONTH.); |
| 439 | } |
| 440 | |
| 441 | static grn_objcxx . . $ grn_obj# * |
| 442 | func_time_classify_yearcxx . . $ func_time_classify_year(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 443 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 444 | { |
| 445 | return func_time_classify_rawcxx . . $ func_time_classify_raw(1a7043a9ed67983c).(ctx, |
| 446 | n_args, |
| 447 | args, |
| 448 | user_data, |
| 449 | "time_classify_year", |
| 450 | GRN_TIME_CLASSIFY_UNIT_YEARcxx . . $ GRN_TIME_CLASSIFY_UNIT_YEAR.); |
| 451 | } |
| 452 | |
| 453 | static grn_objcxx . . $ grn_obj# * |
| 454 | func_time_classify_day_of_weekcxx . . $ func_time_classify_day_of_week(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 455 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 456 | { |
| 457 | const char *function_name = "time_classify_day_of_week"; |
| 458 | grn_objcxx . . $ grn_obj# *time; |
| 459 | |
| 460 | if (n_args != 1) { |
| 461 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 462 | "%s(): " |
| 463 | "wrong number of arguments (%d for 1)", |
| 464 | function_name, |
| 465 | n_args); |
| 466 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 467 | } |
| 468 | |
| 469 | time = args[0]; |
| 470 | if (!(time->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`! && |
| 471 | time->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_TIMEcxx . . $ GRN_DB_TIME.)) { |
| 472 | grn_objcxx . . $ grn_obj# inspected; |
| 473 | |
| 474 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 475 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, time); |
| 476 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 477 | "%s(): " |
| 478 | "the first argument must be a time: " |
| 479 | "<%.*s>", |
| 480 | function_name, |
| 481 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 482 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 483 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 484 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 485 | } |
| 486 | |
| 487 | { |
| 488 | int64_tcxx . . $ int64_t# time_raw; |
| 489 | struct tmcxx . . $ tm# tm; |
| 490 | grn_objcxx . . $ grn_obj# *day_of_week; |
| 491 | |
| 492 | time_raw = GRN_TIME_VALUEcxx . . $ `include/groonga/groonga.h:3109:9`!(time); |
| 493 | if (!grn_time_to_tmcxx . . $ grn_time_to_tm(f8a68ae4da1a7edf).(ctx, time_raw, &tm)) { |
| 494 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 495 | } |
| 496 | |
| 497 | day_of_week = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, |
| 498 | user_data, |
| 499 | GRN_DB_UINT8cxx . . $ GRN_DB_UINT8., |
| 500 | 0); |
| 501 | if (!day_of_week) { |
| 502 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 503 | } |
| 504 | GRN_UINT8_SETcxx . . $ `include/groonga/groonga.h:2889:9`!(ctx, day_of_week, tm.tm_wday); |
| 505 | |
| 506 | return day_of_week; |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | static grn_objcxx . . $ grn_obj# * |
| 511 | func_time_formatcxx . . $ func_time_format(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 512 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 513 | { |
| 514 | grn_objcxx . . $ grn_obj# *time; |
| 515 | grn_objcxx . . $ grn_obj# *format; |
| 516 | |
| 517 | if (n_args != 2) { |
| 518 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 519 | "time_format(): " |
| 520 | "wrong number of arguments (%d for 2)", |
| 521 | n_args); |
| 522 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 523 | } |
| 524 | |
| 525 | time = args[0]; |
| 526 | format = args[1]; |
| 527 | |
| 528 | if (!(time->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`! && |
| 529 | time->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_TIMEcxx . . $ GRN_DB_TIME.)) { |
| 530 | grn_objcxx . . $ grn_obj# inspected; |
| 531 | |
| 532 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 533 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, time); |
| 534 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 535 | "time_format(): " |
| 536 | "the first argument must be a time: " |
| 537 | "<%.*s>", |
| 538 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 539 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 540 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 541 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 542 | } |
| 543 | |
| 544 | if (!grn_obj_is_text_family_bulkcxx . . $ grn_obj_is_text_family_bulk(a5760e5c319a06ee).(ctx, format)) { |
| 545 | grn_objcxx . . $ grn_obj# inspected; |
| 546 | |
| 547 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 548 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, format); |
| 549 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 550 | "time_format(): " |
| 551 | "the second argument must be a string: " |
| 552 | "<%.*s>", |
| 553 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 554 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 555 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 556 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 557 | } |
| 558 | |
| 559 | { |
| 560 | int64_tcxx . . $ int64_t# time_raw; |
| 561 | struct tmcxx . . $ tm# tm; |
| 562 | grn_objcxx . . $ grn_obj# nul_terminated_format; |
| 563 | grn_objcxx . . $ grn_obj# *formatted_time; |
| 564 | char formatted_time_buffer[4096]; |
| 565 | size_t formatted_time_size; |
| 566 | |
| 567 | time_raw = GRN_TIME_VALUEcxx . . $ `include/groonga/groonga.h:3109:9`!(time); |
| 568 | if (!grn_time_to_tmcxx . . $ grn_time_to_tm(f8a68ae4da1a7edf).(ctx, time_raw, &tm)) { |
| 569 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 570 | } |
| 571 | |
| 572 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&nul_terminated_format, 0); |
| 573 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, |
| 574 | &nul_terminated_format, |
| 575 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(format), |
| 576 | GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(format)); |
| 577 | GRN_TEXT_PUTCcxx . . $ `include/groonga/groonga.h:2775:9`!(ctx, &nul_terminated_format, '\0'); |
| 578 | |
| 579 | formatted_time_size = strftimecxx . . $ strftime(98e75925167c4f1b).(formatted_time_buffer, |
| 580 | sizeof(formatted_time_buffer), |
| 581 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&nul_terminated_format), |
| 582 | &tm); |
| 583 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &nul_terminated_format); |
| 584 | |
| 585 | formatted_time = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, GRN_DB_TEXTcxx . . $ GRN_DB_TEXT., 0); |
| 586 | GRN_TEXT_SETcxx . . $ `include/groonga/groonga.h:2761:9`!(ctx, |
| 587 | formatted_time, |
| 588 | formatted_time_buffer, |
| 589 | formatted_time_size); |
| 590 | |
| 591 | return formatted_time; |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | static grn_objcxx . . $ grn_obj# * |
| 596 | func_time_format_iso8601cxx . . $ func_time_format_iso8601(fd082858389c8bb0).(grn_ctxcxx . . $ grn_ctx# *ctx, int n_args, grn_objcxx . . $ grn_obj# **args, |
| 597 | grn_user_datacxx . . $ grn_user_data# *user_data) |
| 598 | { |
| 599 | const char *function_name = "time_format_iso8601"; |
| 600 | grn_objcxx . . $ grn_obj# *time; |
| 601 | |
| 602 | if (n_args != 1) { |
| 603 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 604 | "%s(): " |
| 605 | "wrong number of arguments (%d for 1)", |
| 606 | function_name, |
| 607 | n_args); |
| 608 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 609 | } |
| 610 | |
| 611 | time = args[0]; |
| 612 | |
| 613 | if (!(time->headercxx . . $ _grn_obj#header..typecxx . . $ _grn_obj_header#type. == GRN_BULKcxx . . $ `include/groonga/groonga.h:868:9`! && |
| 614 | time->headercxx . . $ _grn_obj#header..domaincxx . . $ _grn_obj_header#domain. == GRN_DB_TIMEcxx . . $ GRN_DB_TIME.)) { |
| 615 | grn_objcxx . . $ grn_obj# inspected; |
| 616 | |
| 617 | GRN_TEXT_INITcxx . . $ `include/groonga/groonga.h:2750:9`!(&inspected, 0); |
| 618 | grn_inspectcxx . . $ grn_inspect(88456f97fe0d41a).(ctx, &inspected, time); |
| 619 | GRN_PLUGIN_ERRORcxx . . $ `include/groonga/plugin.h:145:9`!(ctx, GRN_INVALID_ARGUMENT, |
| 620 | "%s(): " |
| 621 | "the first argument must be a time: " |
| 622 | "<%.*s>", |
| 623 | function_name, |
| 624 | (int)GRN_TEXT_LENcxx . . $ `include/groonga/groonga.h:2786:9`!(&inspected), |
| 625 | GRN_TEXT_VALUEcxx . . $ `include/groonga/groonga.h:2785:9`!(&inspected)); |
| 626 | GRN_OBJ_FINcxx . . $ `include/groonga/groonga.h:958:9`!(ctx, &inspected); |
| 627 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 628 | } |
| 629 | |
| 630 | { |
| 631 | int64_tcxx . . $ int64_t# time_raw; |
| 632 | struct tmcxx . . $ tm# tm; |
| 633 | int64_tcxx . . $ int64_t# time_sec; |
| 634 | int32_tcxx . . $ int32_t# time_usec; |
| 635 | grn_objcxx . . $ grn_obj# *formatted_time; |
| 636 | |
| 637 | time_raw = GRN_TIME_VALUEcxx . . $ `include/groonga/groonga.h:3109:9`!(time); |
| 638 | if (!grn_time_to_tmcxx . . $ grn_time_to_tm(f8a68ae4da1a7edf).(ctx, time_raw, &tm)) { |
| 639 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 640 | } |
| 641 | |
| 642 | GRN_TIME_UNPACKcxx . . $ `include/groonga/time.h:52:9`!(time_raw, time_sec, time_usec); |
| 643 | |
| 644 | formatted_time = grn_plugin_proc_alloccxx . . $ grn_plugin_proc_alloc(acb267eca6702fc).(ctx, user_data, GRN_DB_TEXTcxx . . $ GRN_DB_TEXT., 0); |
| 645 | if (!formatted_time) { |
| 646 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 647 | } |
| 648 | |
| 649 | grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, |
| 650 | formatted_time, |
| 651 | "%04d-%02d-%02dT%02d:%02d:%02d.%06d", |
| 652 | tm.tm_yearcxx . . $ tm#tm_year. + 1900, |
| 653 | tm.tm_moncxx . . $ tm#tm_mon. + 1, |
| 654 | tm.tm_mdaycxx . . $ tm#tm_mday., |
| 655 | tm.tm_hourcxx . . $ tm#tm_hour., |
| 656 | tm.tm_mincxx . . $ tm#tm_min., |
| 657 | tm.tm_seccxx . . $ tm#tm_sec., |
| 658 | time_usec); |
| 659 | #ifdef HAVE_STRUCT_TM_TM_GMTOFFcxx . . $ `build/config.h:155:9`! |
| 660 | grn_text_printfcxx . . $ grn_text_printf(34596149d4dc0292).(ctx, |
| 661 | formatted_time, |
| 662 | "%+03d:%02d", |
| 663 | (int32_tcxx . . $ int32_t#)(tm.tm_gmtoffcxx . . $ tm#tm_gmtoff. / 3600), |
| 664 | abscxx . . $ abs(7864480464b09eea).((int32_tcxx . . $ int32_t#)(tm.tm_gmtoffcxx . . $ tm#tm_gmtoff. % 3600))); |
| 665 | #elif defined(HAVE_TIMEGM) /* HAVE_STRUCT_TM_TM_GMTOFF */ |
| 666 | { |
| 667 | time_t gmtoff = timegm(&tm) - time_sec; |
| 668 | grn_text_printf(ctx, |
| 669 | formatted_time, |
| 670 | "%+03d:%02d", |
| 671 | (int32_t)(gmtoff / 3600), |
| 672 | abs((int32_t)(gmtoff % 3600))); |
| 673 | } |
| 674 | #endif /* HAVE_STRUCT_TM_TM_GMTOFF */ |
| 675 | return formatted_time; |
| 676 | } |
| 677 | } |
| 678 | |
| 679 | grn_rccxx . . $ grn_rc# |
| 680 | GRN_PLUGIN_INITcxx . . $ `include/groonga/plugin.h:43:9`!(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 681 | { |
| 682 | return ctx->rccxx . . $ _grn_ctx#rc.; |
| 683 | } |
| 684 | |
| 685 | grn_rccxx . . $ grn_rc# |
| 686 | GRN_PLUGIN_REGISTERcxx . . $ `include/groonga/plugin.h:44:9`!(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 687 | { |
| 688 | grn_rccxx . . $ grn_rc# rc = GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 689 | |
| 690 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, |
| 691 | "time_classify_second", -1, |
| 692 | GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., |
| 693 | func_time_classify_secondcxx . . $ func_time_classify_second(fd082858389c8bb0)., |
| 694 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 695 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, |
| 696 | "time_classify_minute", -1, |
| 697 | GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., |
| 698 | func_time_classify_minutecxx . . $ func_time_classify_minute(fd082858389c8bb0)., |
| 699 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 700 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, |
| 701 | "time_classify_hour", -1, |
| 702 | GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., |
| 703 | func_time_classify_hourcxx . . $ func_time_classify_hour(fd082858389c8bb0)., |
| 704 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 705 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, |
| 706 | "time_classify_day", -1, |
| 707 | GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., |
| 708 | func_time_classify_daycxx . . $ func_time_classify_day(fd082858389c8bb0)., |
| 709 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 710 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, |
| 711 | "time_classify_week", -1, |
| 712 | GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., |
| 713 | func_time_classify_weekcxx . . $ func_time_classify_week(fd082858389c8bb0)., |
| 714 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 715 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, |
| 716 | "time_classify_month", -1, |
| 717 | GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., |
| 718 | func_time_classify_monthcxx . . $ func_time_classify_month(fd082858389c8bb0)., |
| 719 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 720 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, |
| 721 | "time_classify_year", -1, |
| 722 | GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., |
| 723 | func_time_classify_yearcxx . . $ func_time_classify_year(fd082858389c8bb0)., |
| 724 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 725 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, |
| 726 | "time_classify_day_of_week", -1, |
| 727 | GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., |
| 728 | func_time_classify_day_of_weekcxx . . $ func_time_classify_day_of_week(fd082858389c8bb0)., |
| 729 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 730 | |
| 731 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, |
| 732 | "time_format", -1, |
| 733 | GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., |
| 734 | func_time_formatcxx . . $ func_time_format(fd082858389c8bb0)., |
| 735 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 736 | grn_proc_createcxx . . $ grn_proc_create(195df001e5324f57).(ctx, |
| 737 | "time_format_iso8601", -1, |
| 738 | GRN_PROC_FUNCTIONcxx . . $ GRN_PROC_FUNCTION., |
| 739 | func_time_format_iso8601cxx . . $ func_time_format_iso8601(fd082858389c8bb0)., |
| 740 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 741 | |
| 742 | return rc; |
| 743 | } |
| 744 | |
| 745 | grn_rccxx . . $ grn_rc# |
| 746 | GRN_PLUGIN_FINcxx . . $ `include/groonga/plugin.h:45:9`!(grn_ctxcxx . . $ grn_ctx# *ctx) |
| 747 | { |
| 748 | return GRN_SUCCESScxx . . $ GRN_SUCCESS.; |
| 749 | } |