Describe the bug

Executing redis.call("TIME") from within the context of a Lua script returns the same value on repeated calls.

To reproduce

Consider the following minimal script:

local function many_pings(_, args)
    local n = args[1]
    local start_time = redis.call("TIME")
    for i = 1, n, 1 do
        redis.call("PING")
    end
    local end_time = redis.call("TIME")
    return { start_time, end_time }
end

redis.register_function {
    function_name = "MANY_PINGS",
    callback = many_pings,
}

Load function: cat sketch.lua | redis-cli -x FUNCTION LOAD REPLACE

Send 1 million pings from command line on version 7.2.0 - note start and end time are the same:

127.0.0.1:6379> FCALL MANY_PINGS 0 1000000
1) 1) "1694017605"
    2) "773607"
2) 1) "1694017605"
    2) "773607"

Expected behavior

Running the above script in Redis version 7.0.12 returns the expected result - note microsecond diff:

127.0.0.1:6379> FCALL MANY_PINGS 0 1000000
1) 1) "1694017077"
    2) "623871"
2) 1) "1694017077"
    2) "956297"

Additional information

Confirmed running Redis natively on Mac M1 installed through homebrew. Confirmed running Redis via Docker on same machine.

INFO details for both versions running through Docker:

127.0.0.1:6379> INFO
# Server
redis_version:7.0.12
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:1ad557430acc5658
redis_mode:standalone
os:Linux 5.15.49-linuxkit-pr aarch64
arch_bits:64
monotonic_clock:POSIX clock_gettime
127.0.0.1:6379> INFO
# Server
redis_version:7.2.0
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:e29d9ec6b7c4d794
redis_mode:standalone
os:Linux 5.15.49-linuxkit-pr aarch64
arch_bits:64
monotonic_clock:POSIX clock_gettime

Comment From: enjoy-binbin

yean, this is a breaking change we made in 7.2, see #10300