Skip to content

Commit

Permalink
rename TIME method to detect_time_value
Browse files Browse the repository at this point in the history
  • Loading branch information
jaromil committed Mar 11, 2024
1 parent be1d312 commit 96f6fee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lua/zencode_data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
-- wrap all conversion functions nested in deepmaps
-- TODO: optimize
if dt == 'number' and encoder_n ~= 'float' and encoder_n ~= 'time' then
if TIME.is_autodetected_time(data) and not CONF.input.number_strict then
if TIME.detect_time_value(data) and not CONF.input.number_strict then
warn("Number value imported as timestamp: "..data)
return TIME.new(data)
else
Expand Down
2 changes: 1 addition & 1 deletion src/lua/zencode_w3c.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ local function decode_jwt_parts(s)
if type(s) == 'string' then
return O.from_string(s)
elseif type(s) == 'number' then
return fif(TIME.is_autodetected_time(s), TIME.new, FLOAT.new)(s)
return fif(TIME.detect_time_value(s), TIME.new, FLOAT.new)(s)
else
return s
end
Expand Down
4 changes: 2 additions & 2 deletions src/zen_time.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ static int newtime(lua_State *L) {
END(1);
}*/

static int is_autodetected_time(lua_State *L) {
static int detect_time_value(lua_State *L) {
BEGIN();
int result = 0;
if(lua_isnumber(L, 1)) {
Expand Down Expand Up @@ -290,7 +290,7 @@ int luaopen_time(lua_State *L) {
{"new", newtime},
{"to_octet", time_to_octet},
//{"is_time", is_time},
{"is_autodetected_time", is_autodetected_time},
{"detect_time_value", detect_time_value},
{NULL, NULL}
};
const struct luaL_Reg time_methods[] = {
Expand Down

0 comments on commit 96f6fee

Please sign in to comment.